Skip to content

Inherited type symbol problem #3591

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
LPTK opened this issue Nov 29, 2017 · 1 comment
Closed

Inherited type symbol problem #3591

LPTK opened this issue Nov 29, 2017 · 1 comment

Comments

@LPTK
Copy link
Contributor

LPTK commented Nov 29, 2017

See the scastie.
The code is reproduced below:

class Base {
  class A
  class B extends A
  type of[+A0 <: A,T] = A0
}
object Base extends Base
import Base._
object Main {
  def foo = new B
  def foo2: B of Any = foo
  
  def main(args: Array[String]) = ()
}

Fails with:

-- [E056] Type Mismatch Error: /tmp/scastie722928142903515025/src/main/scala/main.scala:10:12 
10 |  def foo2: B of Any = foo
   |            ^
   |       Type argument Base.B does not conform to upper bound Base.this.A 

It works in Scalac, and it works in Dotty if the definitions are moved to the object!

PS: note that it has nothing to do with object Base having the same name as class Base.

@smarter
Copy link
Member

smarter commented Nov 29, 2017

Hmm, I guess there's a missing substitution somewhere. Here's a minimization:

class Foo {
  class A

  type Bla[X <: A] = X
}

class Bar extends Foo {
  val y: Bla[A] = ???
    // error: Type argument Bar.this.A does not conform to upper bound Foo.this.A 
}

smarter added a commit that referenced this issue Nov 30, 2017
Fix #3591: fix paramInfoAsSeenFrom for type lambdas
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