Skip to content

Spec: Opaque type aliases. #17947

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 20, 2023
Merged

Spec: Opaque type aliases. #17947

merged 1 commit into from
Jun 20, 2023

Conversation

sjrd
Copy link
Member

@sjrd sjrd commented Jun 9, 2023

[skip ci]

Based on #17940.

@sjrd sjrd force-pushed the spec-opaque-type-aliases branch from d499013 to 248e014 Compare June 14, 2023 09:35
@sjrd sjrd requested a review from bishabosha June 20, 2023 07:23
Comment on lines -54 to -55
Opaque type aliases cannot be `private` and cannot be overridden in subclasses.
Opaque type aliases cannot have a context function type as right-hand side.
Copy link
Member

@bishabosha bishabosha Jun 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like these restrictions are not mentioned

Comment on lines -57 to -69
## Type Parameters of Opaque Types

Opaque type aliases can have a single type parameter list. The following aliases
are well-formed
```scala
opaque type F[T] = (T, T)
opaque type G = [T] =>> List[T]
```
but the following are not:
```scala
opaque type BadF[T] = [U] =>> (T, U)
opaque type BadG = [T] =>> [U] => (T, U)
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again this restriction is not mentioned

Copy link
Member

@bishabosha bishabosha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like some points are missing in the spec

@sjrd sjrd force-pushed the spec-opaque-type-aliases branch from 248e014 to 5b74c9b Compare June 20, 2023 12:29
@sjrd
Copy link
Member Author

sjrd commented Jun 20, 2023

Good catch about the missing restrictions! I have added them.

@sjrd sjrd requested a review from bishabosha June 20, 2023 12:30
@sjrd sjrd force-pushed the spec-opaque-type-aliases branch from 5b74c9b to 229738f Compare June 20, 2023 12:32
@bishabosha bishabosha assigned sjrd and unassigned bishabosha Jun 20, 2023
@sjrd sjrd merged commit 47ec229 into scala:main Jun 20, 2023
@sjrd sjrd deleted the spec-opaque-type-aliases branch June 20, 2023 12:58
Kordyjan added a commit that referenced this pull request Dec 8, 2023
Backports #17947 to the LTS branch.

PR submitted by the release tooling.
[skip ci]
@Kordyjan Kordyjan added this to the 3.3.2 milestone Dec 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants