Skip to content

Commit 4329240

Browse files
committed
Sema: Remove TupleType::getVarArgsBaseType()
Or, actually, now that there's only one usage left move it to CSDiag. Hopefully, both vararg tuple types and CSDiag are going away eventually.
1 parent 06392ab commit 4329240

File tree

3 files changed

+10
-18
lines changed

3 files changed

+10
-18
lines changed

include/swift/AST/Types.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1876,11 +1876,6 @@ class TupleType final : public TypeBase, public llvm::FoldingSetNode,
18761876
/// return the element index, otherwise return -1.
18771877
int getNamedElementId(Identifier I) const;
18781878

1879-
/// If this tuple has a varargs element to it, return the base type of the
1880-
/// varargs element (i.e., if it is "Int...", this returns Int, not [Int]).
1881-
/// Otherwise, this returns Type().
1882-
Type getVarArgsBaseType() const;
1883-
18841879
/// Returns true if this tuple has inout elements.
18851880
bool hasInOutElement() const {
18861881
return static_cast<bool>(Bits.TupleType.HasInOutElement);

lib/AST/Type.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2422,18 +2422,6 @@ int TupleType::getNamedElementId(Identifier I) const {
24222422
return -1;
24232423
}
24242424

2425-
/// If this tuple has a varargs element to it, return the base type of the
2426-
/// varargs element (i.e., if it is "Int...", this returns Int, not [Int]).
2427-
/// Otherwise, this returns Type().
2428-
Type TupleType::getVarArgsBaseType() const {
2429-
for (unsigned i = 0, e = Bits.TupleType.Count; i != e; ++i) {
2430-
if (getTrailingObjects<TupleTypeElt>()[i].isVararg())
2431-
return getTrailingObjects<TupleTypeElt>()[i].getVarargBaseTy();
2432-
}
2433-
2434-
return Type();
2435-
}
2436-
24372425

24382426
ArchetypeType::ArchetypeType(
24392427
const ASTContext &Ctx,

lib/Sema/CSDiag.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8296,7 +8296,16 @@ bool FailureDiagnosis::visitTupleExpr(TupleExpr *TE) {
82968296
}
82978297

82988298
if (!variadicArgs.empty()) {
8299-
auto varargsTy = contextualTT->getVarArgsBaseType();
8299+
Type varargsTy;
8300+
for (auto &elt : contextualTT->getElements()) {
8301+
if (elt.isVararg()) {
8302+
varargsTy = elt.getVarargBaseTy();
8303+
break;
8304+
}
8305+
}
8306+
8307+
assert(varargsTy);
8308+
83008309
for (unsigned i = 0, e = variadicArgs.size(); i != e; ++i) {
83018310
unsigned inArgNo = variadicArgs[i];
83028311

0 commit comments

Comments
 (0)