Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
7cea875
Make "did you mean hints" less chatty
odersky Dec 28, 2019
9a3c33a
Make suggestions of missing implicits imports on type errors
odersky Dec 28, 2019
53a6098
Sort suggestions alphabetically
odersky Dec 29, 2019
b848c57
Don't treat package object's <init> methods as package members
odersky Dec 30, 2019
13c1839
Refine search and reporting criteria
odersky Dec 30, 2019
e1360eb
Don't suggest imports for conversions from Null or Nothing
odersky Dec 30, 2019
5e3f11c
Implement cancellation
odersky Dec 31, 2019
540f69a
Subject implicit suggestion searches to timeouts
odersky Dec 31, 2019
2ccec1f
Streamline suggestion printing
odersky Jan 1, 2020
51f19ec
Use java.util.Timer
odersky Jan 1, 2020
55b1a31
Drop Scheduler
odersky Jan 2, 2020
9c67ee4
Revise search logic
odersky Jan 2, 2020
b3a4966
Some refinements
odersky Jan 2, 2020
717cb7d
Refine implicit search criterion and prioritization
odersky Jan 4, 2020
ad5055b
Further refinement of "did you mean" hints
odersky Jan 4, 2020
848dd0a
Print package symbols always under their full names
odersky Jan 4, 2020
72df855
Fix repl test
odersky Jan 4, 2020
0501bfa
Refactorings and comments for better clarity
odersky Jan 4, 2020
1124b35
Fix two more repl tests
odersky Jan 4, 2020
c601a72
Issue a "did you mean" hint only if there's nothing else to say
odersky Jan 5, 2020
02d7594
Remove dead code and data in "did you mean" hints
odersky Jan 5, 2020
9e72e6c
Better explanation for missing members that have extension methods
odersky Jan 5, 2020
aabcd81
Also suggest imports of extension methods
odersky Jan 5, 2020
427da51
Factor out suggestions logic into its own trait
odersky Jan 5, 2020
5ac8b80
Also suggest partial matches for missing implicit arguments
odersky Jan 5, 2020
8289d51
Don't mention evidence$n parameters in error message
odersky Jan 5, 2020
6f94a83
Fix unrelated test
odersky Jan 5, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Sort suggestions alphabetically
This is needed to get stability of test outputs. But we should
try to find more useful sorting criteria.
  • Loading branch information
odersky committed Dec 29, 2019
commit 53a6098fd8e51d2d42726400bb47b4d00fa2dbde
5 changes: 3 additions & 2 deletions compiler/src/dotty/tools/dotc/typer/Implicits.scala
Original file line number Diff line number Diff line change
Expand Up @@ -761,8 +761,9 @@ trait Implicits { self: Typer =>
def suggestStr(ref: TermRef) = i" import ${refToString(ref)}"
if suggestedRefs.isEmpty then ""
else
val suggestions = suggestedRefs.map(suggestStr).distinct
// TermRefs might be different but generate the same strings
val suggestions = suggestedRefs.map(suggestStr)
.distinct // TermRefs might be different but generate the same strings
.sorted // To get test stability. TODO: Find more useful sorting criteria
val fix =
if suggestions.tail.isEmpty then "The following import"
else "One of the following imports"
Expand Down
4 changes: 2 additions & 2 deletions compiler/test-resources/repl/importFromObj
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ val res0: scala.collection.mutable.ListBuffer[Int] = ListBuffer(1, 2, 3)
scala> import util.foo
1 | import util.foo
| ^^^
| value foo is not a member of util - did you mean util.Try?
| value foo is not a member of util
scala> import util.foo.bar
1 | import util.foo.bar
| ^^^^^^^^
| value foo is not a member of util - did you mean util.Try?
| value foo is not a member of util
4 changes: 2 additions & 2 deletions tests/neg/missing-implicit.check
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
|
| One of the following imports might fix the problem:
|
| import math.Ordering.Implicits.infixOrderingOps
| import math.Ordered.orderingToOrdered
| import math.Ordering.Implicits.infixOrderingOps
|
-- [E008] Member Not Found Error: tests/neg/missing-implicit.scala:5:51 ------------------------------------------------
5 | case x :: xs1 if limit > 0 => consume(xs1, limit - x) // error // error
Expand All @@ -16,8 +16,8 @@
| One of the following imports might fix the problem:
|
| import math.Fractional.Implicits.infixFractionalOps
| import math.Numeric.Implicits.infixNumericOps
| import math.Integral.Implicits.infixIntegralOps
| import math.Numeric.Implicits.infixNumericOps
|
-- Error: tests/neg/missing-implicit.scala:10:24 -----------------------------------------------------------------------
10 |val f = Future[Unit] { } // error
Expand Down