Skip to content

Commit f5adb70

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

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

+1-1
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

+1-1
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

+3-3
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

+1-1
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

+2-2
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@ class SpaceEngine(using Context) extends SpaceLogic {
771771

772772
val sym = tp.classSymbol
773773

774-
if (ctx.definitions.isTupleType(tp))
774+
if (ctx.definitions.isTupleNType(tp))
775775
params(tp).map(_ => "_").mkString("(", ", ", ")")
776776
else if (scalaListType.isRef(sym))
777777
if (flattenList) "_*" else "_: List"
@@ -785,7 +785,7 @@ class SpaceEngine(using Context) extends SpaceLogic {
785785
else if (decomposed) "_: " + showType(tp, showTypeArgs = true)
786786
else "_"
787787
case Prod(tp, fun, params) =>
788-
if (ctx.definitions.isTupleType(tp))
788+
if (ctx.definitions.isTupleNType(tp))
789789
"(" + params.map(doShow(_)).mkString(", ") + ")"
790790
else if (tp.isRef(scalaConsType.symbol))
791791
if (flattenList) params.map(doShow(_, flattenList)).filter(_.nonEmpty).mkString(", ")

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

+1-1
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

+2-2
Original file line numberDiff line numberDiff line change
@@ -1694,8 +1694,8 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
16941694
val tpNoRefinement = self.dropDependentRefinement
16951695
tpNoRefinement != self
16961696
&& dotc.core.Symbols.defn.isNonRefinedFunction(tpNoRefinement)
1697-
def isTupleType: Boolean =
1698-
dotc.core.Symbols.defn.isTupleType(self)
1697+
def isTupleNType: Boolean =
1698+
dotc.core.Symbols.defn.isTupleNType(self)
16991699
def select(sym: Symbol): TypeRepr = self.select(sym)
17001700
def appliedTo(targ: TypeRepr): TypeRepr =
17011701
dotc.core.Types.decorateTypeApplications(self).appliedTo(targ)

library/src/scala/quoted/Quotes.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -2477,7 +2477,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
24772477
*
24782478
* @return true if the dealiased type of `self` is `TupleN[T1, T2, ..., Tn]`
24792479
*/
2480-
def isTupleType: Boolean
2480+
def isTupleNType: Boolean
24812481

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

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

+1-1
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)