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
implicit members inconsistent support in structural types #9085
Comments
Imported From: https://issues.scala-lang.org/browse/SI-9085?orig=1 |
@retronym said: If there are no use cases, I would favour removing the implicit flag from the symbol in inferred structural types. |
@xeno-by said: |
Scala 3 (3.3.0-RC3) also rejects the explicit structural type: scala> type Foo = AnyRef { given fooMsg: String }
-- Error: ----------------------------------------------------------------------
1 |type Foo = AnyRef { given fooMsg: String }
| ^^^^^^^^^^^^^^^^^^^^
| refinement cannot be `given` and the loophole involving type inference is closed scala> val a = new { given fooMsg: String = "a" }
val a: Object = anon$1@4bab78ce closing the ticket, as I think a design change here is out of scope for Scala 2, especially since Scala 3 has kept the door shut on the structural type |
Can't even parse that:
But can do this (pay attention for the inferred structural type):
So,
AnyRef{implicit val fooMsg: String}
seems to be very confusing for the user especially as it can't even be parsedAs it has no actual effect:
I would either
implicit
keyword and say "we will ignore it in typecheck as it can be overriden with non-implicit"The text was updated successfully, but these errors were encountered: