-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Description
Compiler version
3.0.0-RC2-bin-20210325-ab2664f-NIGHTLY
Problem
It is not enough to special-case Nothing
(type-ascribing only trees of this type as in #11917). In principle, all inlined parameters may require a type annotation. This is because removing type annotations in Scala can break type checking, as subtyping is not transitive.
Minimized code
type A
class B { def foo = 0 }
trait Ev { type T >: A <: B }
inline // commenting this fixes the error
def test(ev: Ev)(x: ev.T): Int = x.foo
def trial(ev: Ev, a: A) = {
test(ev)(a) // foo cannot be accessed as a member of (a : A) from module class main$package$.
}
Expectation
If it type-checks without inline
, it should type-check with inline
too. In particular, I assume that non-transparent inline
is not supposed to interfere with type checking in any way. Is that a correct assumption?
liufengyun