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

Unexpected opaque type argument widening across dependencies #13128

Closed
soronpo opened this issue Jul 22, 2021 · 1 comment · Fixed by #13206
Closed

Unexpected opaque type argument widening across dependencies #13128

soronpo opened this issue Jul 22, 2021 · 1 comment · Fixed by #13206

Comments

@soronpo
Copy link
Contributor

soronpo commented Jul 22, 2021

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.

@smarter
Copy link
Member

smarter commented Jul 22, 2021

It works with def grabT[T <: Int & Singleton] but it's very weird that separate compilation makes a difference here yeah.

odersky added a commit to dotty-staging/dotty that referenced this issue Jul 30, 2021
odersky added a commit to dotty-staging/dotty that referenced this issue Jul 30, 2021
tanishiking pushed a commit to tanishiking/dotty that referenced this issue Aug 10, 2021
smarter pushed a commit to dotty-staging/dotty that referenced this issue Aug 11, 2021
@Kordyjan Kordyjan added this to the 3.1.0 milestone Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants