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

Some concrete dependent types are not properly expanded #10038

Open
scabug opened this issue Nov 10, 2016 · 1 comment
Open

Some concrete dependent types are not properly expanded #10038

scabug opened this issue Nov 10, 2016 · 1 comment

Comments

@scabug
Copy link

scabug commented Nov 10, 2016

Welcome to Scala 2.12.0 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_102).
Type in expressions for evaluation. Or try :help.

scala> trait InvariantContainer[T0] {
     |   type T = T0
     | }
defined trait InvariantContainer

scala> type OptionalContainer[Container <: InvariantContainer[_]] = InvariantContainer[Option[Container#T]]
defined type alias OptionalContainer

scala> def expand(x: OptionalContainer[InvariantContainer[Int]]): InvariantContainer[Option[InvariantContainer[Int]#T]] = x
<console>:13: error: type mismatch;
 found   : OptionalContainer[InvariantContainer[Int]]
    (which expands to)  InvariantContainer[Option[_$1]]
 required: InvariantContainer[Option[Int]]
       def expand(x: OptionalContainer[InvariantContainer[Int]]): InvariantContainer[Option[InvariantContainer[Int]#T]] = x
                                                                                                                          ^

scala> def expand(x: OptionalContainer[InvariantContainer[Int]]): InvariantContainer[Option[Int]] = x
<console>:13: error: type mismatch;
 found   : OptionalContainer[InvariantContainer[Int]]
    (which expands to)  InvariantContainer[Option[_$1]]
 required: InvariantContainer[Option[Int]]
       def expand(x: OptionalContainer[InvariantContainer[Int]]): InvariantContainer[Option[Int]] = x
                                                                                                    ^

I expect that scalac does not error here, because T is a concrete type, which should be expanded immediately.

@scabug
Copy link
Author

scabug commented Nov 10, 2016

Imported From: https://issues.scala-lang.org/browse/SI-10038?orig=1
Reporter: @Atry
Affected Versions: 2.12.0

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