Skip to content

Commit 83e0288

Browse files
committed
Fix isTupleNType, which is documented to act on the dealiased type
1 parent e96d460 commit 83e0288

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

compiler/src/dotty/tools/dotc/core/Definitions.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1489,10 +1489,11 @@ class Definitions {
14891489
* @return true if the dealiased type of `tp` is `TupleN[T1, T2, ..., Tn]`
14901490
*/
14911491
def isTupleNType(tp: Type)(using Context): Boolean = {
1492-
val arity = tp.dealias.argInfos.length
1492+
val tp1 = tp.dealias
1493+
val arity = tp1.argInfos.length
14931494
arity <= MaxTupleArity && {
14941495
val tupletp = TupleType(arity)
1495-
tupletp != null && tp.isRef(tupletp.symbol)
1496+
tupletp != null && tp1.isRef(tupletp.symbol)
14961497
}
14971498
}
14981499

tests/run/i14587.opaques.scala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
object Test:
2+
opaque type Tup = (Int, String)
3+
4+
def test(tup: Tup) =
5+
val (n, s) = tup
6+
assert(n == 1 && s == "")
7+
8+
def main(args: Array[String]): Unit = test((1, ""))

0 commit comments

Comments
 (0)