Skip to content

Rechecking inferred type arguments fails. #9697

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

Open
sstucki opened this issue Sep 1, 2020 · 0 comments
Open

Rechecking inferred type arguments fails. #9697

sstucki opened this issue Sep 1, 2020 · 0 comments
Labels
area:typer backlog No work planned on this by the core team for the time being. help wanted itype:bug

Comments

@sstucki
Copy link
Contributor

sstucki commented Sep 1, 2020

Minimized code

type Foo[+X >: Nothing <: Nothing] = Nothing
type Bar[+X >: Any     <: Any]     = Nothing

sealed trait Comp[-A, -B, -F[+X >: A <: B], +C, +D, +G[+Y >: C <: D]]
case class Refl[A, B, F[+X >: A <: B]]() extends Comp[A, B, F, A, B, F]

// OK (but fails with -Ycheck:typer).
val foobar: Comp[Nothing, Nothing, Foo, Any, Any, Bar] = Refl()

// Fails: a version of `foobar` with explicit type arguments.
// (The type arguments were extracted using -Xprint:typer).
val foobar2: Comp[Nothing, Nothing, Foo, Any, Any, Bar] =
  Refl[Any, Any, [X >: Any] =>> Nothing]()

Output

-- [E007] Type Mismatch Error: CompFail.scala:13:40 --------------------------
13 |  Refl[Any, Any, [X >: Any] =>> Nothing]()
   |  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |  Found:    Refl[Any, Any, [X >: Any] =>> Nothing]
   |  Required: Comp[Nothing, Nothing, Foo, Any, Any, Bar]
1 error found

Expectation

This probably shouldn't type check, but I'm really not sure. In any case, the versions with and without explicit type arguments should behave the same way.

The correct behavior here probably depends on how bounds of (abstract) type operators should be handled in subtype checking, which is presumably related to issues #6499/#6320.

Mentioning @Blaisorblade and @smarter since this resulted from a discussion we had.

@odersky odersky added the backlog No work planned on this by the core team for the time being. label Apr 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:typer backlog No work planned on this by the core team for the time being. help wanted itype:bug
Projects
None yet
Development

No branches or pull requests

3 participants