Skip to content

Commit 660f66d

Browse files
committed
Delete the IsTypeLocImplicit Bit
1 parent 2516089 commit 660f66d

File tree

6 files changed

+7
-23
lines changed

6 files changed

+7
-23
lines changed

include/swift/AST/Decl.h

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -369,21 +369,14 @@ class alignas(1 << DeclAlignInBits) Decl {
369369
IsPropertyWrapperBackingProperty : 1
370370
);
371371

372-
SWIFT_INLINE_BITFIELD(ParamDecl, VarDecl, 1+2+1+NumDefaultArgumentKindBits,
372+
SWIFT_INLINE_BITFIELD(ParamDecl, VarDecl, 1+2+NumDefaultArgumentKindBits,
373373
/// Whether we've computed the specifier yet.
374374
SpecifierComputed : 1,
375375

376376
/// The specifier associated with this parameter. This determines
377377
/// the storage semantics of the value e.g. mutability.
378378
Specifier : 2,
379379

380-
/// True if the type is implicitly specified in the source, but this has an
381-
/// apparently valid typeRepr. This is used in accessors, which look like:
382-
/// set (value) {
383-
/// but need to get the typeRepr from the property as a whole so Sema can
384-
/// resolve the type.
385-
IsTypeLocImplicit : 1,
386-
387380
/// Information about a symbolic default argument, like #file.
388381
defaultArgumentKind : NumDefaultArgumentKindBits
389382
);
@@ -5220,10 +5213,7 @@ class ParamDecl : public VarDecl {
52205213
SourceLoc getParameterNameLoc() const { return ParameterNameLoc; }
52215214

52225215
SourceLoc getSpecifierLoc() const { return SpecifierLoc; }
5223-
5224-
bool isTypeLocImplicit() const { return Bits.ParamDecl.IsTypeLocImplicit; }
5225-
void setIsTypeLocImplicit(bool val) { Bits.ParamDecl.IsTypeLocImplicit = val; }
5226-
5216+
52275217
DefaultArgumentKind getDefaultArgumentKind() const {
52285218
return static_cast<DefaultArgumentKind>(Bits.ParamDecl.defaultArgumentKind);
52295219
}

lib/AST/ASTPrinter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2524,7 +2524,7 @@ void PrintAST::visitVarDecl(VarDecl *decl) {
25242524
if (decl->hasInterfaceType()) {
25252525
Printer << ": ";
25262526
TypeLoc tyLoc;
2527-
if (auto *repr = tyLoc.getTypeRepr())
2527+
if (auto *repr = decl->getTypeRepr())
25282528
tyLoc = TypeLoc(repr, decl->getInterfaceType());
25292529
else
25302530
tyLoc = TypeLoc::withoutLoc(decl->getInterfaceType());

lib/AST/ASTWalker.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1158,7 +1158,7 @@ class Traversal : public ASTVisitor<Traversal, Expr*, Stmt*,
11581158

11591159
// Don't walk into the type if the decl is implicit, or if the type is
11601160
// implicit.
1161-
if (!P->isImplicit() && !P->isTypeLocImplicit()) {
1161+
if (!P->isImplicit()) {
11621162
if (auto *repr = P->getTypeRepr()) {
11631163
if (doIt(repr)) {
11641164
return true;

lib/AST/Decl.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5726,7 +5726,6 @@ ParamDecl::ParamDecl(SourceLoc specifierLoc,
57265726
ArgumentName(argumentName), ParameterNameLoc(parameterNameLoc),
57275727
ArgumentNameLoc(argumentNameLoc), SpecifierLoc(specifierLoc) {
57285728
Bits.ParamDecl.SpecifierComputed = false;
5729-
Bits.ParamDecl.IsTypeLocImplicit = false;
57305729
Bits.ParamDecl.defaultArgumentKind =
57315730
static_cast<unsigned>(DefaultArgumentKind::None);
57325731
}
@@ -5737,12 +5736,10 @@ ParamDecl *ParamDecl::cloneWithoutType(const ASTContext &Ctx, ParamDecl *PD) {
57375736
PD->getArgumentNameLoc(), PD->getParameterName(), PD->getDeclContext());
57385737
Clone->DefaultValueAndFlags.setPointerAndInt(
57395738
nullptr, PD->DefaultValueAndFlags.getInt());
5740-
Clone->Bits.ParamDecl.IsTypeLocImplicit =
5741-
PD->Bits.ParamDecl.IsTypeLocImplicit;
57425739
Clone->Bits.ParamDecl.defaultArgumentKind =
57435740
PD->Bits.ParamDecl.defaultArgumentKind;
57445741
if (auto *repr = PD->getTypeRepr())
5745-
Clone->setTypeRepr(repr->clone(PD->getASTContext()));
5742+
Clone->setTypeRepr(repr->clone(Ctx));
57465743

57475744
Clone->setSpecifier(PD->getSpecifier());
57485745
Clone->setImplicitlyUnwrappedOptional(PD->isImplicitlyUnwrappedOptional());
@@ -5805,7 +5802,7 @@ SourceRange ParamDecl::getSourceRange() const {
58055802
// If the typeloc has a valid location, use it to end the range.
58065803
if (auto typeRepr = getTypeRepr()) {
58075804
auto endLoc = typeRepr->getEndLoc();
5808-
if (endLoc.isValid() && !isTypeLocImplicit())
5805+
if (endLoc.isValid())
58095806
return SourceRange(startLoc, endLoc);
58105807
}
58115808

lib/Parse/ParseDecl.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4310,9 +4310,6 @@ static ParamDecl *createSetterAccessorArgument(SourceLoc nameLoc,
43104310
if (isNameImplicit)
43114311
result->setImplicit();
43124312

4313-
// AST Walker shouldn't go into the type recursively.
4314-
result->setIsTypeLocImplicit(true);
4315-
43164313
return result;
43174314
}
43184315

test/Constraints/closures.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,7 @@ struct rdar30347997 {
870870
struct rdar43866352<Options> {
871871
func foo() {
872872
let callback: (inout Options) -> Void
873-
callback = { (options: Options) in } // expected-error {{cannot assign value of type '(inout Options) -> ()' to type '(inout _) -> Void'}}
873+
callback = { (options: Options) in } // expected-error {{cannot assign value of type '(Options) -> ()' to type '(inout Options) -> Void'}}
874874
}
875875
}
876876

0 commit comments

Comments
 (0)