File tree 2 files changed +13
-1
lines changed
compiler/src/dotty/tools/dotc/typer
2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -756,7 +756,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
756
756
return typedSelect(tree, pt, qual)
757
757
758
758
// Otherwise, try to expand a named tuple selection
759
- val namedTupleElems = qual.tpe.widen .namedTupleElementTypes
759
+ val namedTupleElems = qual.tpe.widenDealias .namedTupleElementTypes
760
760
val nameIdx = namedTupleElems.indexWhere(_._1 == selName)
761
761
if nameIdx >= 0 && Feature .enabled(Feature .namedTuples) then
762
762
return typed(
Original file line number Diff line number Diff line change
1
+ import scala .language .experimental .namedTuples
2
+
3
+ object Test1 :
4
+ // original code from issue https://github.com/scala/scala3/issues/20439
5
+ val bar = (a = 1 , b = 2 )
6
+
7
+ type ThatBar = bar.type
8
+ val thatBar : ThatBar = bar
9
+ val thatBar2 : bar.type = bar
10
+
11
+ def test2 = thatBar.a // error
12
+ def test3 = thatBar2.a // ok
You can’t perform that action at this time.
0 commit comments