File tree 5 files changed +52
-7
lines changed
compiler/src/dotty/tools/dotc/typer
5 files changed +52
-7
lines changed Original file line number Diff line number Diff line change @@ -247,11 +247,9 @@ object Implicits:
247
247
candidates += Candidate (ref, ckind, level)
248
248
249
249
if considerExtension then
250
- val tryExtension = tryCandidate(extensionOnly = true )
251
- companionRefs.foreach(tryExtension)
250
+ companionRefs.foreach(tryCandidate(extensionOnly = true ))
252
251
if refs.nonEmpty then
253
- val tryGiven = tryCandidate(extensionOnly = false )
254
- refs.foreach(tryGiven)
252
+ refs.foreach(tryCandidate(extensionOnly = false ))
255
253
candidates.toList
256
254
}
257
255
}
@@ -1373,6 +1371,7 @@ trait Implicits:
1373
1371
if cand1.ref eq cand.ref then
1374
1372
lazy val wildTp = wildApprox(tp.widenExpr)
1375
1373
if belowByname && (wildTp <:< wildPt) then
1374
+ fullyDefinedType(tp, " by-name implicit parameter" , span)
1376
1375
false
1377
1376
else if prev.typeSize > ptSize || prev.coveringSet != ptCoveringSet then
1378
1377
loop(outer, tp.isByName || belowByname)
Original file line number Diff line number Diff line change @@ -6,9 +6,7 @@ object Test {
6
6
implicit def case1 [F [_]](implicit t : => TC [F [Any ]]): TC [Tuple2K [[_] =>> Any , F , Any ]] = ???
7
7
implicit def case2 [A , F [_]](implicit r : TC [F [Any ]]): TC [A ] = ???
8
8
9
- // Disabled because it leads to an infinite loop in implicit search
10
- // this is probably the same issue as https://github.com/lampepfl/dotty/issues/9568
11
- // implicitly[TC[Int]] // was: error
9
+ implicitly[TC [Int ]] // typechecks because we infer F := Nothing (should we avoid inferring Nothing for higher-kinded types?)
12
10
}
13
11
14
12
object Test1 {
Original file line number Diff line number Diff line change
1
+ -- Error: tests/neg/i9568.scala:13:10 ----------------------------------------------------------------------------------
2
+ 13 | blaMonad.foo(bla) // error: diverges
3
+ | ^
4
+ |no implicit argument of type => Monad[([_$3] =>> Any)] was found for parameter ev of method blaMonad in object Test.
5
+ |I found:
6
+ |
7
+ | Test.blaMonad[Nothing, S](Test.blaMonad[F, S])
8
+ |
9
+ |But method blaMonad in object Test does not match type => Monad[Nothing].
Original file line number Diff line number Diff line change
1
+ trait Monad [F [_]] {
2
+ def foo [A ](fa : F [A ]): Unit = {}
3
+ }
4
+
5
+ class Bla [F [_], A ]
6
+
7
+ object Test {
8
+ type Id [A ] = A
9
+
10
+ val bla : Bla [Id , Unit ] = ???
11
+ implicit def blaMonad [F [_], S ](implicit ev : => Monad [F ]): Monad [({type L [X ] = Bla [F , X ]})# L ] = ???
12
+
13
+ blaMonad.foo(bla) // error: diverges
14
+ }
Original file line number Diff line number Diff line change
1
+ trait Monad [F [_]] {
2
+ def foo [A ](fa : F [A ]): Unit = {}
3
+ }
4
+
5
+ class Bla [F [_], A ]
6
+
7
+ object Test1 {
8
+ type Id [A ] = A
9
+
10
+ val bla : Bla [Id , Unit ] = ???
11
+ implicit def blaMonad [F [_]: Monad , S ]: Monad [({type L [X ] = Bla [F , X ]})# L ] = ???
12
+ implicit def idMonad : Monad [Id ] = ???
13
+
14
+ blaMonad.foo(bla) // does not diverge
15
+ }
16
+
17
+ object Test2 {
18
+ type Id [A ] = A
19
+
20
+ val bla : Bla [Id , Unit ] = ???
21
+ implicit def blaMonad [F [_], S ](implicit ev : => Monad [F ]): Monad [({type L [X ] = Bla [F , X ]})# L ] = ???
22
+ implicit def idMonad : Monad [Id ] = ???
23
+
24
+ blaMonad.foo(bla) // does not diverge
25
+ }
You can’t perform that action at this time.
0 commit comments