-
Notifications
You must be signed in to change notification settings - Fork 1.1k
NullPointerException on polymorphic and dependent function applied to itself #6682
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It looks like we are trying to read an uninitialiezed field |
After some diagnosis, it seems to me this is a problem with the caching of The following equivalent program compiles fine without any problem. object O{
val v = [T] => (y:T) => (x:y.type) => 3
val u = [T] => (y:T) => (x:y.type) => 3
def m = v(u)
} More concretely, we are calling tp = TypeVar(TypeParamRef(T)#3218 -> RefinedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),trait PolyFunction),apply,PolyType#3217(List(T), List(TypeBounds(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Nothing),TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Any))), MethodType#3219(List(y), List(TypeParamRef(T)#3218), AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),trait Function1),List(TermParamRef(y)#3220, TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)))))))
param = TypeParamRef(T)#3218
replacement = RefinedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),trait PolyFunction),apply,PolyType#3217(List(T), List(TypeBounds(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Nothing),TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Any))), MethodType#3219(List(y), List(TypeParamRef(T)#3218), AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),trait Function1),List(TermParamRef(y)#3220, TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)))))) Notice that |
Fix #6682: Add regression test
Code:
Output:
The text was updated successfully, but these errors were encountered: