Skip to content

Misleading explanation with invalid type bounds #15568

Closed
@s5bug

Description

@s5bug

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    itype:bugstat:needs triageEvery issue needs to have an "area" and "itype" label

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions