Skip to content

Commit bfd7fa5

Browse files
committed
https://github.com/manifold-systems/manifold/issues/584
- changes that may help diagnose this issue
1 parent f1d1c6f commit bfd7fa5

File tree

5 files changed

+20
-15
lines changed

5 files changed

+20
-15
lines changed

manifold-core-parent/manifold-rt/src/main/java/manifold/rt/api/util/TypesUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ static boolean isStructuralInterface( Types types, Symbol sym )
4747

4848
for( Attribute.Compound annotation : sym.getAnnotationMirrors() )
4949
{
50-
if( annotation.type.toString().equals( STRUCTURAL ) )
50+
if( annotation.type != null && annotation.type.toString().equals( STRUCTURAL ) )
5151
{
5252
return true;
5353
}

manifold-core-parent/manifold/src/main/java/manifold/internal/javac/ManTypes.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,19 @@ public interface ManTypes
3030
* Note, this tests the _erased_ types of t and s. Handling generics here is a bridge too for, for now.
3131
*/
3232
default boolean isAssignableToStructuralType( Type t, Type s )
33+
{
34+
try
35+
{
36+
return _isAssignableToStructuralType( t, s );
37+
}
38+
catch( Throwable e )
39+
{
40+
// todo: diagnose this
41+
// as a diagnostic, prevent this check from causing an exception to quietly test if it is causing compilation failure
42+
return false;
43+
}
44+
}
45+
default boolean _isAssignableToStructuralType( Type t, Type s )
3346
{
3447
t = types().erasure( t );
3548
s = types().erasure( s );

manifold-core-parent/manifold/src/main/java/manifold/internal/javac/ManTypes_17.java17

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,7 @@ public class ManTypes_17 extends Types implements ManTypes
525525
{
526526
return true;
527527
}
528+
528529
return super.returnTypeSubstitutable( r1, r2, r2res, warner );
529530
}
530531

@@ -552,14 +553,10 @@ public class ManTypes_17 extends Types implements ManTypes
552553
return super.isConvertible( t, s, warn );
553554
}
554555

555-
public boolean isSubtype(Type t, Type s, boolean capture)
556+
public boolean isSubtype( Type t, Type s, boolean capture )
556557
{
557-
if( isAssignableToStructuralType( t, s ) )
558-
{
559-
return true;
560-
}
561-
562-
return super.isSubtype(t, s, capture);
558+
return super.isSubtype( t, s, capture ) ||
559+
isAssignableToStructuralType( t, s );
563560
}
564561

565562
@Override

manifold-core-parent/manifold/src/main/java/manifold/internal/javac/ManTypes_8.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -550,13 +550,8 @@ public boolean isConvertible( Type t, Type s, Warner warn )
550550

551551
public boolean isSubtype( Type t, Type s, boolean capture )
552552
{
553-
if( isAssignableToStructuralType( t, s ) )
554-
{
555-
// t is structurally assignable to s
556-
return true;
557-
}
558-
559-
return super.isSubtype(t, s, capture);
553+
return super.isSubtype( t, s, capture ) ||
554+
isAssignableToStructuralType( t, s );
560555
}
561556

562557
@Override

0 commit comments

Comments
 (0)