-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Inference of Dependent Function Types gives "Unspecified Error" #5526
Comments
Here is part of the problem analysis, cross-posted at #4130:
Further analysis showed that it goes back to Namer. While typechecking the non-dependent variant of I am currently preparing a fix and will open a PR soon |
The fix I had in mind was to call case DependentTypeTree(tpFun) =>
val tpe = tpFun(paramss.head)
if (!isFullyDefined(tpe, ForceDegree.none)) {
typedAheadExpr(mdef.rhs, tpe).tpe
} else {
tpe
} However, it is not general enough. The following example still does not typecheck: trait F[A, -E]
def empty[A](value: A): F[A, Any] = ???
def hof[R](f: (p: AnyRef) => F[R, p.type]): F[R, Any] = ???
hof { p =>
empty(42)
} Again, annotating |
With ff284d4 the second test case checks as well. Not sure what caused this, though. Maybe the increased force degree in Typer? |
Fix #5526: Better type inference for dependent function types
The following code example leads to an "unspecified error":
It does type check when annotating the call to
foo
:Also, removing the dependent function type from
foo
does typecheck:This might be related to #4130, but extracted to a separate issue since it might be fixable, independently.
The text was updated successfully, but these errors were encountered: