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
When an opaque type is an alias of a singleton type (literal or term), then in the companion object, the conversion from the singleton type to the alias type does not work. The conversion in the other direction works.
Test code 1:
objectA{
opaquetypeT=3objectT {
valx:T=3
}
}
Output
-- [E007] Type Mismatch Error: opaque-singleton.scala:4:15 ---------
4 | val x: T = 3
| ^
| Found: Int(3)
| Required: A.T.T'
|
| where: T is a object in object A
| T' is a type in object T
one error found
Test code 2:
objectO{
valx=3opaquetypeT= x.typeobjectT {
defwrap(a: x.type):T= a // Errordefunwrap(a: T): x.type= a // OK
}
}
The text was updated successfully, but these errors were encountered:
When an opaque type is an alias of a singleton type (literal or term), then in the companion object, the conversion from the singleton type to the alias type does not work. The conversion in the other direction works.
Test code 1:
Output
Test code 2:
The text was updated successfully, but these errors were encountered: