Skip to content

Inheritance through a parameterized type alias fails #4557

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
OlivierBlanvillain opened this issue May 22, 2018 · 1 comment
Closed

Inheritance through a parameterized type alias fails #4557

OlivierBlanvillain opened this issue May 22, 2018 · 1 comment

Comments

@OlivierBlanvillain
Copy link
Contributor

OlivierBlanvillain commented May 22, 2018

class Parser[T, Elem]

object Test {
  type P[T] = Parser[T, Char]
  class CustomParser extends P[Unit]
}

Dotty wrongly complains that Test.P is not a class type

@Blaisorblade Blaisorblade changed the title Inheritance thought a type alias Inheritance through a type alias fails May 26, 2018
@Blaisorblade Blaisorblade changed the title Inheritance through a type alias fails Inheritance through a parameterized type alias fails Jun 6, 2018
@Blaisorblade
Copy link
Contributor

Blaisorblade commented Jun 6, 2018

So apparently the problem is only with applied types — contrast working:

object Test {
  class Parser[T, Elem]
  type P = Parser[Unit, Char]
  class CustomParser extends P
}

with failing:

object Test {
  class Parser[T, Elem]
  type P[T] = Parser[T, Char]
  class CustomParser extends P[Unit]
}

Also note how it complains on Test.P not Test.P[Unit], and that's crucial.
Modifying the error in checkClassType to be

      case tp1 =>
        ctx.error(ex"$tp is not a class type, it's ${tp.dealias} hence $tp1", pos)
        defn.ObjectType

gives

Test.P is not a class type, it's [T] => Test.Parser[T, Char] hence <nonsensical><notype></nonsensical>

allanrenucci added a commit that referenced this issue Jul 25, 2018
Fix #4557: Handle untpd.New with HKTypeLambda
odersky added a commit to dotty-staging/dotty that referenced this issue Jul 26, 2018
We need to keep the original type

 - to allow IDE naviagtion
 - to make PrepareTransparent work correctly
odersky added a commit to dotty-staging/dotty that referenced this issue Jul 26, 2018
We need to keep the original type

 - to allow IDE naviagtion
 - to make PrepareTransparent work correctly
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

3 participants