-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Inline member selection breaks with Nothing arguments #8612
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
I don't think there's anything we can do here. Did you have some fix in mind? |
Maybe when inlining a Nothing, we can ascribe it. Something where |
I am reluctant to make things more complicated. Are there real usecases where we need this? |
I started writing some code with calling inline functions but placed the ??? as a placeholder while I wrote the other arguments and noticed the failure. It is mostly a potential usability issue with where things would fail with unhelpfully error messages. |
From first principles---in this case, "If the invocation typechecks, then the expansion also typechecks"---, this should work. Also: the same problem will arise with We had the same issue in the Scala.js IR at some point. Optimizations could reduce a term previously well-typed into |
Note that 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$.
} |
minimized code
Compilation output
The text was updated successfully, but these errors were encountered: