diff --git a/lisa/lisa-sdk/src/main/java/it/unive/lisa/type/ReferenceType.java b/lisa/lisa-sdk/src/main/java/it/unive/lisa/type/ReferenceType.java index f2f43c7a9..c7c680761 100644 --- a/lisa/lisa-sdk/src/main/java/it/unive/lisa/type/ReferenceType.java +++ b/lisa/lisa-sdk/src/main/java/it/unive/lisa/type/ReferenceType.java @@ -30,13 +30,18 @@ public ReferenceType( @Override public boolean canBeAssignedTo( Type other) { - return other instanceof PointerType || other.isUntyped(); + return other instanceof ReferenceType && getInnerType().canBeAssignedTo(other.asReferenceType().getInnerType()) || other.isUntyped(); } @Override public Type commonSupertype( Type other) { - return equals(other) ? this : Untyped.INSTANCE; + if (equals(other)) + return this; + else if (other instanceof ReferenceType) + return new ReferenceType(getInnerType().commonSupertype(other.asReferenceType().getInnerType())); + + return Untyped.INSTANCE; } @Override