Skip to content

Commit fdd43d7

Browse files
authored
Merge pull request #14750 from dotty-staging/fix-i13900
Prevent implicit conversion chaining
2 parents fa3893e + 4660ad7 commit fdd43d7

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

compiler/src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3270,7 +3270,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
32703270
if isExtension then return found
32713271
else
32723272
checkImplicitConversionUseOK(found)
3273-
return typedSelect(tree, pt, found)
3273+
return withoutMode(Mode.ImplicitsEnabled)(typedSelect(tree, pt, found))
32743274
case failure: SearchFailure =>
32753275
if failure.isAmbiguous then
32763276
return

tests/neg/i13900.scala

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
opaque type Inlined[T] = T
2+
3+
object Inlined:
4+
5+
given fromValueWide[Wide]: Conversion[Wide, Inlined[Wide]] = ???
6+
7+
// TODO: This used to make the compiler run into an infinite loop.
8+
// Now it fails instead but shouldn't, see discussion in https://github.com/lampepfl/dotty/issues/13900#issuecomment-1075580792
9+
def myMax: Int = 1 max 2 // error

0 commit comments

Comments
 (0)