You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The only way to relax them would be to somehow detect that the parameter to A ends up as the initializer of the field a. But we could detect that only after type checking. So, I don't think that would be practical.
Even if the aliasing were detected, it's not obvious that the usage is intended without more explicit syntax.
This belongs to the class of "pass-thru" init, class X(_) extends Y(_). Whatever the hypothetical syntax, "apply incoming params directly to a thing." (Without danger of alias.)
Fixing code in Scala 2 project, similar example with tree, which is assumed to mean the only possible tree under consideration. Hypothetical syntax new C(tree' = tree) to mean the arg must be aliased to member of that name, and refchecked.
Uh oh!
There was an error while loading. Please reload this page.
Minimized code
Output
Expectation
The code compiles in both dotty 0.23 and scala 2.3.1
The text was updated successfully, but these errors were encountered: