Skip to content

Type parameter inference broken for parent of an enum case #2663

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
smarter opened this issue Jun 2, 2017 · 1 comment
Closed

Type parameter inference broken for parent of an enum case #2663

smarter opened this issue Jun 2, 2017 · 1 comment

Comments

@smarter
Copy link
Member

smarter commented Jun 2, 2017

This works:

class Foo[T](x: T)
class Bar[T](y: T) extends Foo(y)

But this doesn't:

enum Foo[T](x: T) {
  case Bar[T](y: T) extends Foo(y)
}
-- [E055] Syntax Error: try/parents.scala:2:28 ---------------------------------
2 |  case Bar[T](y: T) extends Foo(y)
  |                            ^^^
  |                            missing type parameter for [Foo$$T] => Foo[T]

Manually adding the missing type parameter works:

enum Foo[T](x: T) {
  case Bar[T](y: T) extends Foo[T](y)
}
@amanjpro
Copy link

amanjpro commented Jul 8, 2017

I will be working on this

odersky added a commit to dotty-staging/dotty that referenced this issue Jan 24, 2018
i2663 demonstrates that we do not always have a complete result type
for the `apply` method of an enum case. In that case our only recourse
is to add a generic widening method that upcasts the enum case class to the
enum base class.
odersky added a commit to dotty-staging/dotty that referenced this issue Jan 24, 2018
i2663 demonstrates that we do not always have a complete result type
for the `apply` method of an enum case. In that case our only recourse
is to add a generic widening method that upcasts the enum case class to the
enum base class.
odersky added a commit to dotty-staging/dotty that referenced this issue Jan 24, 2018
i2663 demonstrates that we do not always have a complete result type
for the `apply` method of an enum case. In that case our only recourse
is to add a generic widening method that upcasts the enum case class to the
enum base class.
odersky added a commit that referenced this issue Jan 28, 2018
Fix #2663: More refined handling of enum case apply results
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

2 participants