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
type inference regression after analyzer plugins patch #7782
Comments
Imported From: https://issues.scala-lang.org/browse/SI-7782?orig=1 |
@retronym said: package pack
object Named {
import O.empty
def foo(empty: Any): Any = ???
// is `empty` a named arg or an assignment? Checking for that has nasty side effects!
foo(empty = ???)
}
object O {
// order matters (!!!)
def empty(implicit a: Any): Any = ???
def empty[E]: C[E] = ???
}
abstract class C[E] {
def foo[BB](f: BB)
def test[B](f: B): Any = foo(f)
}
|
@retronym said (edited on Aug 26, 2013 9:58:29 AM UTC): package pack
object Test {
import O.empty
empty // this will trigger PolyTypeCompleter of `test`
// which picks up `skolemizationLevel = 1` from the in-flight `isAsSpecific` check
// that happens to be computing `Any <:< pack.this.C[E] forSome { E }`
}
object O {
// order matters (!!!)
def empty(implicit a: Any): Any = ???
def empty[E]: C[E] = ???
}
abstract class C[E] {
def foo[BB](f: BB)
def test[B](f: B): Any = foo(f)
// error: no type parameters for method foo: (<param> f: BB)scala.this.Unit exist so that it can be applied to arguments (B&1)
// --- because ---
// argument expression's type is not compatible with formal parameter type;
// found : B&1
// required: ?BB
} |
@retronym said: package pack
object Test {
import O.empty
empty // this will trigger completion of `test`
// with skolemizationLevel = 1
}
object O {
// order matters (!!!)
// def empty(implicit a: Any): Any = ???
def empty[E]: C[E] = ???
def empty(implicit a: Any): Any = ???
}
abstract class C[E] {
def foo[BB](f: BB)
def test[B](f: B): Any = foo(f)
// error: no type parameters for method foo: (<param> f: BB)scala.this.Unit exist so that it can be applied to arguments (B&1)
// --- because ---
// argument expression's type is not compatible with formal parameter type;
// found : B&1
// required: ?BB
} I had to switch the order of the case ExistentialType(_, _) =>
try {
skolemizationLevel += 1
isSubType(tp1.skolemizeExistential, tp2, depth)
} finally {
skolemizationLevel -= 1
}
This test case regresses at: b74c33eb860622e363 "SI-1803, plus documentation and cleanups in Namers, mainly in typeSig". I think the fix is to force the level of skolems derived in |
@retronym said: |
The text was updated successfully, but these errors were encountered: