checker-framework icon indicating copy to clipboard operation
checker-framework copied to clipboard

type inference crashed: AsSuperVisitor: unexpected combination

Open theosotr opened this issue 1 year ago • 1 comments

Command

javac -J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \
  -J--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED \
  -J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \
  -J--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED \
  -J--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED \
  -J--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED \
  -J--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \
  -J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED \
  -J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED \
-processor org.checkerframework.checker.nullness.NullnessChecker \
-nowarn -cp checker-framework/checker/dist/checker.jar -Aignorejdkastub Test.java

File

import java.util.*;

public class Test {
  static public void test(Comparator<Map[]> x,
                          Collection<Map[]> y,
                          Collection<? extends Map[]> z) {
      java.util.Collections.min((true) ? y: z, x);
  }
}

Actual behavior

Test.java:7: error: [type.argument.inference.crashed] Type argument inference crashed for Collections.min
      java.util.Collections.min((true) ? y: z, x);
                               ^
  error: An exception occurred: AsSuperVisitor: unexpected combination:  type: [TYPEVAR class org.checkerframework.framework.type.AnnotatedTypeMirror$AnnotatedTypeVariable] capture#01 extends Map</*RAW*/> []  supertype: [ARRAY class org.checkerframework.framework.type.AnnotatedTypeMirror$AnnotatedArrayType] Map</*Type args not initialized*/>[]
Test.java:7: error: [type.argument.inference.crashed] Type argument inference crashed for Collections.min
      java.util.Collections.min((true) ? y: z, x);
                               ^
  error: An exception occurred: AsSuperVisitor: unexpected combination:  type: [TYPEVAR class org.checkerframework.framework.type.AnnotatedTypeMirror$AnnotatedTypeVariable] capture#01 extends @Initialized @NonNull Map</*RAW*/> @Initialized @NonNull []  supertype: [ARRAY class org.checkerframework.framework.type.AnnotatedTypeMirror$AnnotatedArrayType] Map</*Type args not initialized*/>[]
2 errors

theosotr avatar Oct 25 '24 15:10 theosotr

FYI, this has been addressed in 3.51.1

theosotr avatar Oct 24 '25 13:10 theosotr