From 17f465f79ffd8299f60c7f4408e8fb3989501d5c Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Sun, 18 Apr 2021 12:37:00 +0200 Subject: [PATCH 1/2] Normalize before querying for tuple component types Fixes #12127 --- compiler/src/dotty/tools/dotc/typer/Applications.scala | 2 +- tests/pos/i12127.scala | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 tests/pos/i12127.scala diff --git a/compiler/src/dotty/tools/dotc/typer/Applications.scala b/compiler/src/dotty/tools/dotc/typer/Applications.scala index b65ca4b5c355..4f87d0741be3 100644 --- a/compiler/src/dotty/tools/dotc/typer/Applications.scala +++ b/compiler/src/dotty/tools/dotc/typer/Applications.scala @@ -118,7 +118,7 @@ object Applications { } def tupleComponentTypes(tp: Type)(using Context): List[Type] = - tp.widenExpr.dealias match + tp.widenExpr.dealias.normalized match case tp: AppliedType => if defn.isTupleClass(tp.tycon.typeSymbol) then tp.args diff --git a/tests/pos/i12127.scala b/tests/pos/i12127.scala new file mode 100644 index 000000000000..ce0ff6b31546 --- /dev/null +++ b/tests/pos/i12127.scala @@ -0,0 +1,5 @@ +val x = Option((1, 2, 3)).map(_ + _ + _) +def foo[T <: Tuple : Tuple.IsMappedBy[Option]](t: T)(f: Tuple.InverseMap[T, Option] => Int) = null +val y = foo(Option(1), Option(2), Option(3))(_ + _ + _) + +//val x: (Tuple3[Int, Int, Int] => Int) = _ + _ + _ From 6b70e1680da328ef1e6e82a9d539c2f79c33be1b Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Sun, 18 Apr 2021 13:38:50 +0200 Subject: [PATCH 2/2] Update pickling exclude list --- compiler/test/dotc/pos-test-pickling.blacklist | 1 + 1 file changed, 1 insertion(+) diff --git a/compiler/test/dotc/pos-test-pickling.blacklist b/compiler/test/dotc/pos-test-pickling.blacklist index e6fd9deb979d..f7b8eaa2a7c0 100644 --- a/compiler/test/dotc/pos-test-pickling.blacklist +++ b/compiler/test/dotc/pos-test-pickling.blacklist @@ -36,6 +36,7 @@ i11236.scala i11247.scala i11250 i9999.scala +i12127.scala # Opaque type i5720.scala