Skip to content

Commit 5445fdf

Browse files
committed
---
yaml --- r: 349071 b: refs/heads/master c: 09034fd h: refs/heads/master i: 349069: 0b4f48a 349067: dda92c1 349063: 9efa442 349055: 3148ab8
1 parent 56eabad commit 5445fdf

File tree

6 files changed

+24
-39
lines changed

6 files changed

+24
-39
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 6974448b1eb8da03aff10a67ae98116da385a37c
2+
refs/heads/master: 09034fdf6660b2437a419ece5da57cc8255bc375
33
refs/heads/master-next: 203b3026584ecad859eb328b2e12490099409cd5
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea

trunk/include/swift/AST/Decl.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6358,10 +6358,6 @@ class EnumElementDecl : public DeclContext, public ValueDecl {
63586358
return hasName() ? getBaseName().getIdentifier().str() : "_";
63596359
}
63606360

6361-
/// Set the interface type of this enum element to the constructor function
6362-
/// type; (Self.Type) -> Self or (Self.Type) -> (Args...) -> Self.
6363-
void computeType();
6364-
63656361
Type getArgumentInterfaceType() const;
63666362

63676363
void setParameterList(ParameterList *params);

trunk/lib/AST/Decl.cpp

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6983,34 +6983,6 @@ SourceRange EnumElementDecl::getSourceRange() const {
69836983
return {getStartLoc(), getNameLoc()};
69846984
}
69856985

6986-
void EnumElementDecl::computeType() {
6987-
assert(!hasInterfaceType());
6988-
6989-
auto &ctx = getASTContext();
6990-
auto *ED = getParentEnum();
6991-
6992-
// The type of the enum element is either (Self.Type) -> Self
6993-
// or (Self.Type) -> (Args...) -> Self.
6994-
auto resultTy = ED->getDeclaredInterfaceType();
6995-
6996-
AnyFunctionType::Param selfTy(MetatypeType::get(resultTy, ctx));
6997-
6998-
if (auto *PL = getParameterList()) {
6999-
SmallVector<AnyFunctionType::Param, 4> argTy;
7000-
PL->getParams(argTy);
7001-
7002-
resultTy = FunctionType::get(argTy, resultTy);
7003-
}
7004-
7005-
if (auto genericSig = ED->getGenericSignature())
7006-
resultTy = GenericFunctionType::get(genericSig, {selfTy}, resultTy);
7007-
else
7008-
resultTy = FunctionType::get({selfTy}, resultTy);
7009-
7010-
// Record the interface type.
7011-
setInterfaceType(resultTy);
7012-
}
7013-
70146986
Type EnumElementDecl::getArgumentInterfaceType() const {
70156987
if (!hasAssociatedValues())
70166988
return nullptr;

trunk/lib/ClangImporter/ImportDecl.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5623,9 +5623,6 @@ Decl *SwiftDeclConverter::importEnumCase(const clang::EnumConstantDecl *decl,
56235623
decl, AccessLevel::Public, SourceLoc(), name, nullptr,
56245624
SourceLoc(), rawValueExpr, theEnum);
56255625

5626-
// Give the enum element the appropriate type.
5627-
element->computeType();
5628-
56295626
Impl.importAttributes(decl, element);
56305627

56315628
return element;

trunk/lib/Sema/TypeCheckDecl.cpp

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4292,7 +4292,29 @@ void TypeChecker::validateDecl(ValueDecl *D) {
42924292
case DeclKind::EnumElement: {
42934293
auto *EED = cast<EnumElementDecl>(D);
42944294
DeclValidationRAII IBV(EED);
4295-
EED->computeType();
4295+
4296+
auto *ED = EED->getParentEnum();
4297+
4298+
// The type of the enum element is either (Self.Type) -> Self
4299+
// or (Self.Type) -> (Args...) -> Self.
4300+
auto resultTy = ED->getDeclaredInterfaceType();
4301+
4302+
AnyFunctionType::Param selfTy(MetatypeType::get(resultTy, Context));
4303+
4304+
if (auto *PL = EED->getParameterList()) {
4305+
SmallVector<AnyFunctionType::Param, 4> argTy;
4306+
PL->getParams(argTy);
4307+
4308+
resultTy = FunctionType::get(argTy, resultTy);
4309+
}
4310+
4311+
if (auto genericSig = ED->getGenericSignature())
4312+
resultTy = GenericFunctionType::get(genericSig, {selfTy}, resultTy);
4313+
else
4314+
resultTy = FunctionType::get({selfTy}, resultTy);
4315+
4316+
// Record the interface type.
4317+
EED->setInterfaceType(resultTy);
42964318
break;
42974319
}
42984320
}

trunk/lib/Serialization/Deserialization.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3578,8 +3578,6 @@ class swift::DeclDeserializer {
35783578
}
35793579
}
35803580

3581-
elem->computeType();
3582-
35833581
if (isImplicit)
35843582
elem->setImplicit();
35853583
elem->setAccess(std::max(cast<EnumDecl>(DC)->getFormalAccess(),

0 commit comments

Comments
 (0)