Skip to content

Excessive implicit import suggestions on type mismatch error val x: 1 | 2 = 3 #8032

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
smarter opened this issue Jan 19, 2020 · 0 comments
Closed
Assignees
Labels
area:reporting Error reporting including formatting, implicit suggestions, etc itype:bug

Comments

@smarter
Copy link
Member

smarter commented Jan 19, 2020

Not sure what's going on here, but we definitely need to tune our heuristics:

val x: 1 | 2 = 3
-- [E007] Type Mismatch Error: try/res.scala:6:15 ------------------------------
6 |val x: 1 | 2 = 3
  |               ^
  |Found:    (3 : Int)
  |Required: (1 : Int) | (2 : Int)
  |
  |One of the following imports might make progress towards fixing the problem:
  |
  |  import Int.int2double
  |  import Int.int2float
  |  import Int.int2long
  |  import math.BigDecimal.int2bigDecimal
  |  import math.BigInt.int2bigInt
  |  import math.Numeric.IntIsIntegral.mkNumericOps
  |  import math.Numeric.BigIntIsIntegral.mkNumericOps
  |  import math.Numeric.IntIsIntegral.mkOrderingOps
  |  import math.Ordering.Int.mkOrderingOps
  |  import Long.long2double
  |  import Long.long2float
  |  import math.BigDecimal.long2bigDecimal
  |  import math.BigInt.long2bigInt
  |  import math.Numeric.LongIsIntegral.mkNumericOps
  |  import math.Numeric.FloatIsFractional.mkNumericOps
  |  import math.Ordering.Long.mkOrderingOps
  |  import Float.float2double
  |  import math.BigDecimal.double2bigDecimal
  |  import math.Numeric.DoubleIsFractional.mkNumericOps
  |  import math.Numeric.BigDecimalAsIfIntegral.mkNumericOps
  |  import math.Numeric.BigDecimalIsFractional.mkNumericOps
  |  import math.Numeric.LongIsIntegral.mkOrderingOps
  |  import math.Numeric.BigDecimalAsIfIntegral.mkOrderingOps
  |  import math.Numeric.BigDecimalIsFractional.mkOrderingOps
  |  import math.Numeric.BigIntIsIntegral.mkOrderingOps
  |  import math.Numeric.FloatIsFractional.mkOrderingOps
  |  import math.Numeric.DoubleIsFractional.mkOrderingOps
  |  import math.Ordering.BigDecimal.mkOrderingOps
  |  import math.Ordering.BigInt.mkOrderingOps
  |  import math.Ordering.DeprecatedFloatOrdering.mkOrderingOps
  |  import math.Ordering.Float.IeeeOrdering.mkOrderingOps
  |  import math.Ordering.Float.TotalOrdering.mkOrderingOps
  |  import math.Ordering.DeprecatedDoubleOrdering.mkOrderingOps
  |  import math.Ordering.Double.IeeeOrdering.mkOrderingOps
  |  import math.Ordering.Double.TotalOrdering.mkOrderingOps
  |  import collection.Searching.search
  |  import math.Fractional.Implicits.infixFractionalOps
  |  import math.Integral.Implicits.infixIntegralOps
  |  import math.Numeric.Implicits.infixNumericOps
  |  import math.Ordered.orderingToOrdered
  |  import math.Ordering.Implicits.infixOrderingOps
  |  import reflect.Selectable.reflectiveSelectable
  |  import util.chaining.scalaUtilChainingOps
  |  import implicits.Not.amb1
  |  import implicits.Not.amb2
  |
1 error found

(by the way, the error message doesn't mention the concept of implicit/given at all, so it might be hard for a user to understand why adding an implicit would make a difference at all)

@smarter smarter added the area:reporting Error reporting including formatting, implicit suggestions, etc label Jan 19, 2020
odersky added a commit that referenced this issue Jan 20, 2020
Fix #8032: Make import suggestions less chatty
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:reporting Error reporting including formatting, implicit suggestions, etc itype:bug
Projects
None yet
Development

No branches or pull requests

2 participants