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
Infinite loop in Typers#adapt with overloaded types, erroneous trees #6912
Comments
Imported From: https://issues.scala-lang.org/browse/SI-6912?orig=1 |
@JamesIry said: |
@retronym said: |
@retronym said (edited on Jan 8, 2013 9:19:54 AM UTC): if (best == NoSymbol) {
// ...
NoBestExprAlternativeError(tree, pt, isSecondTry)
} else if (!competing.isEmpty) {
if (noAlternatives) NoBestExprAlternativeError(tree, pt, isSecondTry)
else if (!pt.isErroneous) AmbiguousExprAlternativeError(tree, pre, best, competing.head, pt, isSecondTry)
} else {
tree.setSymbol(best).setType(pre.memberType(best))
} This commit seems relevant: + // since inferMethodAlternative modifies the state of the tree
+ // we have to set the type of tree to ErrorType only in the very last
+ // fallback action that is done in the inference (tracking it manually is error prone).
+ // This avoids entering infinite loop in doTypeApply.
+ // TODO: maybe we should do the same thing with inferExprAlternative.
+ if (implicitly[Context].reportErrors) setError(tree) It was refined later in: See also: // side-effect on the tree, break the overloaded type cycle in infer
private def setErrorOnLastTry(lastTry: Boolean, tree: Tree) = if (lastTry) setError(tree) Actually, digging back a bit further: } else if (!competing.isEmpty) {
- if (secondTry) {
- typeErrorTree(tree, tree.symbol.tpe, pt)
- } else {
- if (!pt.isErroneous)
- context.ambiguousError(tree.pos, pre, best, competing.head, "expected type " + pt)
- setError(tree)
- }
+ if (secondTry) NoBestExprAlternativeError(tree, pt)
+ else { if (!pt.isErroneous) AmbiguousExprAlternativeError(tree, pre, best, competing.head, pt) }
} else { Before that change, in the condition mentioned above, |
@retronym said: |
@paulp said: |
I haven't minimized this one yet.
The loop appears:
The text was updated successfully, but these errors were encountered: