dotty-knowledge
dotty-knowledge copied to clipboard
Seeming typo in example code for opaques
In the section on Bounds For Opaque Type Aliases
The example code block
object Access:
opaque type Permissions = Int
opaque type PermissionChoice = Int
opaque type Permission <: Permissions & PermissionChoice = Int
extension (x: Permissions)
def & (y: Permissions): Permissions = x | y
extension (x: PermissionChoice)
def | (y: PermissionChoice): PermissionChoice = x | y
Seems to be wrong in that the &
and the |
both are doing x | y
in the body.
I suspect that the first one should actually be x & y
like this.
def & (y: Permissions): Permissions = x & y