Skip to content

Commit 6fad310

Browse files
committed
Rename isTupleType to isTupleNType
to make explicit tthe fact that it does not cover `Tuple`, `EmptyTuple`, `NonEmptyTuple` and `*:`.
1 parent 3fa63cb commit 6fad310

File tree

9 files changed

+13
-13
lines changed

9 files changed

+13
-13
lines changed

compiler/src/dotty/tools/dotc/ast/CheckTrees.scala.disabled

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ object CheckTrees {
217217
optionArg.argTypesHi match {
218218
case Nil =>
219219
optionArg :: Nil
220-
case tupleArgs if defn.isTupleType(optionArg) =>
220+
case tupleArgs if defn.isTupleNType(optionArg) =>
221221
tupleArgs
222222
}
223223
case _ =>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1466,7 +1466,7 @@ class Definitions {
14661466
*
14671467
* @return true if the dealiased type of `self` is `TupleN[T1, T2, ..., Tn]`
14681468
*/
1469-
def isTupleType(tp: Type)(using Context): Boolean = {
1469+
def isTupleNType(tp: Type)(using Context): Boolean = {
14701470
val arity = tp.dealias.argInfos.length
14711471
arity <= MaxTupleArity && TupleType(arity) != null && tp.isRef(TupleType(arity).symbol)
14721472
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,7 +1180,7 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
11801180
compareLower(info2, tyconIsTypeRef = true)
11811181
case info2: ClassInfo =>
11821182
tycon2.name.startsWith("Tuple") &&
1183-
defn.isTupleType(tp2) && recur(tp1, tp2.toNestedPairs) ||
1183+
defn.isTupleNType(tp2) && recur(tp1, tp2.toNestedPairs) ||
11841184
tryBaseType(info2.cls)
11851185
case _ =>
11861186
fourthTry
@@ -2620,9 +2620,9 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
26202620
fullyInstantiated(tp2) && !tp1.classSymbols.exists(_.derivesFrom(tp2.symbol))
26212621
case (tp1: TypeRef, tp2: TermRef) if isEnumValue(tp2) =>
26222622
fullyInstantiated(tp1) && !tp2.classSymbols.exists(_.derivesFrom(tp1.symbol))
2623-
case (tp1: Type, tp2: Type) if defn.isTupleType(tp1) =>
2623+
case (tp1: Type, tp2: Type) if defn.isTupleNType(tp1) =>
26242624
provablyDisjoint(tp1.toNestedPairs, tp2)
2625-
case (tp1: Type, tp2: Type) if defn.isTupleType(tp2) =>
2625+
case (tp1: Type, tp2: Type) if defn.isTupleNType(tp2) =>
26262626
provablyDisjoint(tp1, tp2.toNestedPairs)
26272627
case (tp1: TypeProxy, tp2: TypeProxy) =>
26282628
provablyDisjoint(tp1.superType, tp2) || provablyDisjoint(tp1, tp2.superType)

compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
147147
changePrec(GlobalPrec) {
148148
val argStr: Text =
149149
if args.length == 2
150-
&& !defn.isTupleType(args.head)
150+
&& !defn.isTupleNType(args.head)
151151
&& !isGiven && !isErased
152152
then
153153
atPrec(InfixPrec) { argText(args.head) }

compiler/src/dotty/tools/dotc/transform/patmat/Space.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,7 @@ class SpaceEngine(using Context) extends SpaceLogic {
768768

769769
val sym = tp.classSymbol
770770

771-
if (ctx.definitions.isTupleType(tp))
771+
if (ctx.definitions.isTupleNType(tp))
772772
params(tp).map(_ => "_").mkString("(", ", ", ")")
773773
else if (scalaListType.isRef(sym))
774774
if (flattenList) "_*" else "_: List"
@@ -782,7 +782,7 @@ class SpaceEngine(using Context) extends SpaceLogic {
782782
else if (decomposed) "_: " + showType(tp, showTypeArgs = true)
783783
else "_"
784784
case Prod(tp, fun, params) =>
785-
if (ctx.definitions.isTupleType(tp))
785+
if (ctx.definitions.isTupleNType(tp))
786786
"(" + params.map(doShow(_)).mkString(", ") + ")"
787787
else if (tp.isRef(scalaConsType.symbol))
788788
if (flattenList) params.map(doShow(_, flattenList)).filter(_.nonEmpty).mkString(", ")

compiler/src/dotty/tools/dotc/typer/Applications.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1363,7 +1363,7 @@ trait Applications extends Compatibility {
13631363
for (argType <- argTypes) assert(!isBounds(argType), unapplyApp.tpe.show)
13641364
val bunchedArgs = argTypes match {
13651365
case argType :: Nil =>
1366-
if (args.lengthCompare(1) > 0 && Feature.autoTuplingEnabled && defn.isTupleType(argType)) untpd.Tuple(args) :: Nil
1366+
if (args.lengthCompare(1) > 0 && Feature.autoTuplingEnabled && defn.isTupleNType(argType)) untpd.Tuple(args) :: Nil
13671367
else args
13681368
case _ => args
13691369
}

compiler/src/scala/quoted/runtime/impl/QuotesImpl.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1738,8 +1738,8 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
17381738
val tpNoRefinement = self.dropDependentRefinement
17391739
tpNoRefinement != self
17401740
&& dotc.core.Symbols.defn.isNonRefinedFunction(tpNoRefinement)
1741-
def isTupleType: Boolean =
1742-
dotc.core.Symbols.defn.isTupleType(self)
1741+
def isTupleNType: Boolean =
1742+
dotc.core.Symbols.defn.isTupleNType(self)
17431743
def select(sym: Symbol): TypeRepr = self.select(sym)
17441744
def appliedTo(targ: TypeRepr): TypeRepr =
17451745
dotc.core.Types.decorateTypeApplications(self).appliedTo(targ)

library/src/scala/quoted/Quotes.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2530,7 +2530,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
25302530
*
25312531
* @return true if the dealiased type of `self` is `TupleN[T1, T2, ..., Tn]`
25322532
*/
2533-
def isTupleType: Boolean
2533+
def isTupleNType: Boolean
25342534

25352535
/** The type <this . sym>, reduced if possible */
25362536
def select(sym: Symbol): TypeRepr

scaladoc/src/dotty/tools/scaladoc/tasty/SyntheticSupport.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ object SyntheticsSupport:
1414
import dotty.tools.dotc
1515
given ctx: dotc.core.Contexts.Context = quotes.asInstanceOf[scala.quoted.runtime.impl.QuotesImpl].ctx
1616
val tpe = rtpe.asInstanceOf[dotc.core.Types.Type]
17-
ctx.definitions.isTupleType(tpe)
17+
ctx.definitions.isTupleNType(tpe)
1818

1919
private def hackIsCompiletimeAppliedType(rtpe: reflect.TypeRepr): Boolean =
2020
import dotty.tools.dotc

0 commit comments

Comments
 (0)