From 4de73517dacacc6396402854215415fc95e2870e Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Wed, 26 May 2021 19:48:25 +0200 Subject: [PATCH] Fix implicit ValueOf synthesis Foxes #12583 --- compiler/src/dotty/tools/dotc/typer/Synthesizer.scala | 2 +- tests/pos/i12583.scala | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 tests/pos/i12583.scala diff --git a/compiler/src/dotty/tools/dotc/typer/Synthesizer.scala b/compiler/src/dotty/tools/dotc/typer/Synthesizer.scala index 629f8dbad3cc..4a68cfbdce39 100644 --- a/compiler/src/dotty/tools/dotc/typer/Synthesizer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Synthesizer.scala @@ -163,7 +163,7 @@ class Synthesizer(typer: Typer)(using @constructorOnly c: Context): formal.argInfos match case arg :: Nil => - fullyDefinedType(arg.dealias, "ValueOf argument", span).normalized match + fullyDefinedType(arg, "ValueOf argument", span).normalized.dealias match case ConstantType(c: Constant) => success(Literal(c)) case TypeRef(_, sym) if sym == defn.UnitClass => diff --git a/tests/pos/i12583.scala b/tests/pos/i12583.scala new file mode 100644 index 000000000000..a680983e92e8 --- /dev/null +++ b/tests/pos/i12583.scala @@ -0,0 +1,5 @@ +case class Wrapper[A <: Singleton](a: A)(using ValueOf[A]) + +def test[A <: Singleton](blabla: Wrapper[A]): Unit = () + +val _ = test(Wrapper("yo")) \ No newline at end of file