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
Although all the examples of opaque types define them in objects, I didn't see any mention in the proposal of opaque types being intentionally disallowed in classes, so I guess it is an issue of the implementation.
Test code:
classC {
opaquetypeT=Int
}
Output:
-- Error: opaque-class.scala:2:2 -----------------------------------
2 | opaque type T = Int
| ^
|type T in object T cannot be accessed as a member of C.this.T.type from class C.
one error found
The text was updated successfully, but these errors were encountered:
As of 0.17.0-bin-20190623-49c4a12-NIGHTLY your example crashes the compiler with:
[error] scala.MatchError: NoType (of class dotty.tools.dotc.core.Types$NoType$)
[error] at dotty.tools.dotc.core.tasty.TreePickler.pickleNewType(TreePickler.scala:270)
[error] at dotty.tools.dotc.core.tasty.TreePickler.pickleType(TreePickler.scala:144)
[error] at dotty.tools.dotc.core.tasty.TreePickler.pickleNewType$$anonfun$4(TreePickler.scala:226)
[error] at dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
[error] at dotty.tools.dotc.core.tasty.TreePickler.withLength(TreePickler.scala:44)
[error] at dotty.tools.dotc.core.tasty.TreePickler.pickleNewType(TreePickler.scala:228)
[error] at dotty.tools.dotc.core.tasty.TreePickler.pickleType(TreePickler.scala:144)
[error] at dotty.tools.dotc.core.tasty.TreePickler.pickleTree$$anonfun$25(TreePickler.scala:529)
[error] at dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
[error] at dotty.tools.dotc.core.tasty.TreePickler.withLength(TreePickler.scala:44)
[error] at dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:533)
[error] at dotty.tools.dotc.core.tasty.TreePickler.pickleDef$$anonfun$2(TreePickler.scala:307)
[error] at dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
[error] at dotty.tools.dotc.core.tasty.TreePickler.withLength(TreePickler.scala:44)
[error] at dotty.tools.dotc.core.tasty.TreePickler.pickleDef(TreePickler.scala:312)
[error] at dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:508)
[error] at dotty.tools.dotc.core.tasty.TreePickler.pickleStats$$anonfun$2(TreePickler.scala:331)
[error] at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)
[error] at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:10)
[error] at scala.collection.immutable.List.foreach(List.scala:392)
Although all the examples of opaque types define them in objects, I didn't see any mention in the proposal of opaque types being intentionally disallowed in classes, so I guess it is an issue of the implementation.
Test code:
Output:
The text was updated successfully, but these errors were encountered: