File tree 3 files changed +41
-1
lines changed
compiler/src/dotty/tools/dotc/typer 3 files changed +41
-1
lines changed Original file line number Diff line number Diff line change @@ -146,7 +146,12 @@ trait ImportSuggestions with
146
146
*/
147
147
def shallowTest (ref : TermRef ): Boolean =
148
148
System .currentTimeMillis < deadLine
149
- && (ref <:< pt)(given ctx .fresh.setExploreTyperState())
149
+ && {
150
+ given Context = ctx.fresh.setExploreTyperState()
151
+ pt match
152
+ case pt : ViewProto => pt.isMatchedBy(ref)
153
+ case _ => normalize(ref, pt) <:< pt
154
+ }
150
155
151
156
/** Test whether a full given term can be synthesized that matches
152
157
* the expected type `pt`.
Original file line number Diff line number Diff line change
1
+ -- Error: tests/neg/missing-implicit2.scala:10:18 ----------------------------------------------------------------------
2
+ 10 | f(given xFromY) // error
3
+ | ^
4
+ | no implicit argument of type Y was found for parameter y of method xFromY
5
+ |
6
+ | The following import might fix the problem:
7
+ |
8
+ | import test.instances.y
9
+ |
10
+ -- Error: tests/neg/missing-implicit2.scala:16:5 -----------------------------------------------------------------------
11
+ 16 | f // error
12
+ | ^
13
+ | no implicit argument of type X was found for parameter x of method f in object test
14
+ |
15
+ | The following import might make progress towards fixing the problem:
16
+ |
17
+ | import instances2.xFromY
18
+ |
Original file line number Diff line number Diff line change
1
+ trait X
2
+ trait Y
3
+ object test with
4
+ def f (given x : X ) = ???
5
+ object instances {
6
+ given y : Y = ???
7
+ }
8
+ locally {
9
+ given xFromY (given y : Y ): X = ???
10
+ f(given xFromY ) // error
11
+ }
12
+ locally {
13
+ object instances2 {
14
+ given xFromY : Y => X = ???
15
+ }
16
+ f // error
17
+ }
You can’t perform that action at this time.
0 commit comments