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
1 |def v: Int = Test(??? : B)
| ^^^^^^^^^^^^^
| found: Test[LongComplictedType]
| required: Int
Note that Dotty completely dealiases the type (i.e., found: Test[LongComplictedType], instead of found: Test[B]). In error messages issued by scalac, you get the type as it is denoted in the code (which is potentially an alias), and you get an "which expands to" line with the dealiased type:
1: error: type mismatch;
found : Test[B]
(which expands to) Test[LongComplictedType]
required: Int
def v: Int = Test(??? : B)
I'd argue that the Scala error messages are better to read since you are also shown the aliased types that do not match (type aliases are often defined to abstract away complexity and thus, it should be easier to interpret the type for the developer reading the error message).
I think the reason is that Dotty infers the type of Test(??? : B) as Test[LongComplictedType] instead of Test[B]. Further, it could also be useful to show both the type as denoted in the code and the expanded type.
The text was updated successfully, but these errors were encountered:
When compiling the following code:
Dotty produces the error message:
Note that Dotty completely dealiases the type (i.e.,
found: Test[LongComplictedType]
, instead offound: Test[B]
). In error messages issued by scalac, you get the type as it is denoted in the code (which is potentially an alias), and you get an "which expands to" line with the dealiased type:I'd argue that the Scala error messages are better to read since you are also shown the aliased types that do not match (type aliases are often defined to abstract away complexity and thus, it should be easier to interpret the type for the developer reading the error message).
I think the reason is that Dotty infers the type of
Test(??? : B)
asTest[LongComplictedType]
instead ofTest[B]
. Further, it could also be useful to show both the type as denoted in the code and the expanded type.The text was updated successfully, but these errors were encountered: