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 mismatch when existential type declared explicitly #6849
Comments
Imported From: https://issues.scala-lang.org/browse/SI-6849?orig=1 |
@paulp said: I'm not 100% sure why the type alias works, but I offer as possibilities:
I'll leave it open for someone more confident about things. |
@adriaanm said: |
Lars Hupel (larsrh) said: scala> class X { object Y }
defined class X
scala> val x = new X
x: X = X <at> 4c769a3
scala> type XY = x.Y.type forSome { val x: X }
warning: there were 2 feature warnings; re-run with -feature for details
defined type alias XY
scala> val y1 = x.Y
y1: x.Y.type = X$Y$@14eee870
scala> val y2: XY = x.Y
y2: XY = X$Y$@14eee870
scala> val y2: (x.Y.type forSome { val x: X }) = x.Y
<console>:9: error: type mismatch;
found : x.Y.type
required: x.Y.type forSome { val x: => X }
val y2: (x.Y.type forSome { val x: X }) = x.Y
^ |
@paulp said: |
Given code snippet does not compile when type of value
v
declared explicitly .The code compiles with type alias or when type of
v
is inferred.The text was updated successfully, but these errors were encountered: