Skip to content

Commit

Permalink
Merge pull request #14750 from dotty-staging/fix-i13900
Browse files Browse the repository at this point in the history
Prevent implicit conversion chaining
  • Loading branch information
odersky committed Mar 23, 2022
2 parents fa3893e + 4660ad7 commit fdd43d7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/typer/Typer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3270,7 +3270,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
if isExtension then return found
else
checkImplicitConversionUseOK(found)
return typedSelect(tree, pt, found)
return withoutMode(Mode.ImplicitsEnabled)(typedSelect(tree, pt, found))
case failure: SearchFailure =>
if failure.isAmbiguous then
return
Expand Down
9 changes: 9 additions & 0 deletions tests/neg/i13900.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
opaque type Inlined[T] = T

object Inlined:

given fromValueWide[Wide]: Conversion[Wide, Inlined[Wide]] = ???

// TODO: This used to make the compiler run into an infinite loop.
// Now it fails instead but shouldn't, see discussion in https://github.com/lampepfl/dotty/issues/13900#issuecomment-1075580792
def myMax: Int = 1 max 2 // error

0 comments on commit fdd43d7

Please sign in to comment.