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

Misleading explanation with invalid type bounds #15568

Closed
s5bug opened this issue Jul 1, 2022 · 0 comments · Fixed by #15571
Closed

Misleading explanation with invalid type bounds #15568

s5bug opened this issue Jul 1, 2022 · 0 comments · Fixed by #15571
Labels
itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label
Milestone

Comments

@s5bug
Copy link

s5bug commented Jul 1, 2022

Compiler version

3.1.3, 3.2.0-RC1

Minimized code

trait Foo[X >: Int <: String]

type Bar = Foo[? >: Int <: String]

Output

-- [E057] Type Mismatch Error: -------------------------------------------------
1 |type Bar = Foo[? >: Int <: String]
  |               ^
  |    Type argument  >: Int <: String does not conform to upper bound String
  |-----------------------------------------------------------------------------
  | Explanation (enabled by `-explain`)
  |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  | I tried to show that
  |    >: Int <: String
  | conforms to
  |   String
  | but the comparison trace ended with `false`:
  |
  |   ==> type bounds [ >: Int <: String]  <:  String
  |     ==> type bounds [ >: Int <: String]  <:  String
  |       ==> String  <:  String (left is approximated)
  |       <== String  <:  String (left is approximated) = true
  |     <== type bounds [ >: Int <: String]  <:  String = true
  |   <== type bounds [ >: Int <: String]  <:  String = true
  |
  | The tests were made under the empty constraint
   -----------------------------------------------------------------------------

Expectation

A comparison trace that actually ends with false, or some more correct error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants