Skip to content
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

Add type type TypeClass = { type Self <: AnyKind } to Predef #20393

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

EugeneFlesselle
Copy link
Contributor

@EugeneFlesselle EugeneFlesselle commented May 13, 2024

Allowed declaring extends TypeClass instead of adding a member type Self, and can be used as an upper bound for something with a Self type.

It's also a good place to put documentation, which I have merely started but should probably be extended, feel free to push modifications.

It is declared a type alias rather than a trait to allow, but not require, using it as a parent.

@EugeneFlesselle EugeneFlesselle marked this pull request as ready for review May 13, 2024 12:39
@@ -542,7 +542,7 @@ class Definitions {
// but does not define it as an explicit class.
val cls = enterCompleteClassSymbol(
ScalaPackageClass, tpnme.Singleton, PureInterfaceCreationFlags | Final | Erased,
List(AnyType))
List(ObjectType))
Copy link
Member

Choose a reason for hiding this comment

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

why is this change made?

* extension (self: Self) def show: String
* }}}
*/
@experimental type TypeClass = { type Self <: AnyKind }
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
@experimental type TypeClass = { type Self <: AnyKind }
@experimental type TypeClass = Any { type Self <: AnyKind }

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.

None yet

2 participants