Skip to content

this.type doesn't work with parameterised types #1554

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

Closed
scabug opened this issue Dec 1, 2008 · 2 comments
Closed

this.type doesn't work with parameterised types #1554

scabug opened this issue Dec 1, 2008 · 2 comments

Comments

@scabug
Copy link

scabug commented Dec 1, 2008

Scala gives errors if you try to use this in combination with parameterised types:

scala> class A { val me: this.type = this }
defined class A

scala> class B { val maybeMe: Option[this.type] = Some(this) }
<console>:5: error: type mismatch;
 found   : Some[B]
 required: Option[B.this.type]
         val maybeMe: Option[this.type] = Some(this)
                                          ^
@scabug
Copy link
Author

scabug commented Dec 1, 2008

Imported From: https://issues.scala-lang.org/browse/SI-1554?orig=1
Reporter: @rickynils

@scabug
Copy link
Author

scabug commented Dec 1, 2008

Geoffrey Alan Washburn (washburn) said:
This is a duplicate of #837.

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

No branches or pull requests

1 participant