Skip to content

Unexpected opaque type argument widening across dependencies #13128

Closed
@soronpo

Description

@soronpo

While it is possiblly related to #12945 and #12950, in this example there is just an opaque type, without any extension methods and implicit invocation and the example is very small, although still requires separate compilation to trigger.

Compiler version

3.0.3-RC1-bin-20210716-cc47c56-NIGHTLY

Minimized code

Minimized project at: https://github.com/soronpo/dottybug/tree/opaque_widen

main/scala/Main.scala

opaque type Foo[T <: Int] = Int

test/scala/Test.scala

def grabT[T <: Int](arg : Foo[T]) : T = ???
final val t1 = grabT(??? : Foo[8])
val t2 : 8 = t1

Output

[error] -- [E007] Type Mismatch Error: C:\IdeaProjects\dottybug\src\test\scala\Test.scala:3:13
[error] 3 |val t2 : 8 = t1
[error]   |             ^^
[error]   |             Found:    (t1 : Int)
[error]   |             Required: (8 : Int)
[error] one error found

Expectation

No error.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions