Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

Seeming typo in example code for opaques #35

Open
IDisposable opened this issue Jul 1, 2021 · 1 comment · Fixed by scala/scala3#14531
Open

Seeming typo in example code for opaques #35

IDisposable opened this issue Jul 1, 2021 · 1 comment · Fixed by scala/scala3#14531

Comments

@IDisposable
Copy link

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
@som-snytt
Copy link

It is only a seeming typo. I contributed a few words to clarify what the example is demonstrating.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants