Skip to content

Erroneous Type Mismatch Error? #2219

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
sir-wabbit opened this issue Apr 11, 2017 · 3 comments
Closed

Erroneous Type Mismatch Error? #2219

sir-wabbit opened this issue Apr 11, 2017 · 3 comments

Comments

@sir-wabbit
Copy link

sir-wabbit commented Apr 11, 2017

type Fst[t[_[_, _]]] = t[[a, b] => a]
type Snd[t[_[_, _]]] = t[[a, b] => b]
final case class Witness[t[_[_, _]], A <: Fst[t]](value: Snd[t])

The compiler prints out:

-- [E007] Type Mismatch Error: tests/alex/test.scala ---------------------------
70 |  final case class Witness[t[_[_, _]], A <: Fst[t]](value: Snd[t])
   |                                                                 ^
   |              found:    Snd[t](Witness.this.value)
   |              required: Snd[(? <: [_$7 <: [_$8, _$9] => Any] => Any)]
@OlivierBlanvillain
Copy link
Contributor

Reproduced, thanks for reporting!

@OlivierBlanvillain
Copy link
Contributor

This is a regression introduced by #2204

@smarter
Copy link
Member

smarter commented Apr 11, 2017

Minimized to not require case class:

object Test {
  type Snd[t[_[_, _]]] = t[[a, b] => b]

  class Witness[t[_[_, _]]](value: Snd[t]) {
    def foo[t[_[_, _]]](value: Snd[t] = value) = {}
  }
}
-- [E007] Type Mismatch Error: try/i2219.scala ---------------------------------
4 |    def foo[t[_[_, _]]](value: Snd[t] = value) = {}
  |                                        ^^^^^
  |              found:    Test.Snd[t](Witness.this.value)
  |              required: Test.Snd[(? <: [_$7 <: [_$8, _$9] => Any] => Any)]

smarter added a commit to dotty-staging/dotty that referenced this issue Apr 11, 2017
Previously we just returned the unapplied WildcardType which is
incorrect if the WildcardType is bounded. The proper thing to do is to
do the type application on the bounds of the WildcardType and wrap the
result in a WildcardType.
smarter added a commit that referenced this issue Apr 11, 2017
Fix #2219: Fix type applications on WildcardType
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