Skip to content

Commit 4e2eb6f

Browse files
committed
Fix isTupleNType, which is documented to act on the dealiased type
1 parent 2f19e30 commit 4e2eb6f

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
@@ -1490,8 +1490,9 @@ class Definitions {
14901490
* @return true if the dealiased type of `tp` is `TupleN[T1, T2, ..., Tn]`
14911491
*/
14921492
def isTupleNType(tp: Type)(using Context): Boolean = {
1493-
val arity = tp.dealias.argInfos.length
1494-
arity <= MaxTupleArity && TupleType(arity) != null && tp.isRef(TupleType(arity).symbol)
1493+
val tp1 = tp.dealias
1494+
val arity = tp1.argInfos.length
1495+
arity <= MaxTupleArity && TupleType(arity) != null && tp1.isRef(TupleType(arity).symbol)
14951496
}
14961497

14971498
def tupleType(elems: List[Type]): Type = {

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)