Skip to content

Commit 123d0c5

Browse files
committed
---
yaml --- r: 284407 b: refs/heads/swift-5.1-branch c: 3d776bc h: refs/heads/master i: 284405: 6c4d5b3 284403: 6ec8cb6 284399: 0b0e6de
1 parent 57cb60c commit 123d0c5

File tree

5 files changed

+25
-10
lines changed

5 files changed

+25
-10
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1242,7 +1242,7 @@ refs/heads/marcrasi-astverifier-disable: 3fac766a23a77ebd0640296bfd7fc116ea60a4e
12421242
refs/heads/revert-22227-a-tall-white-fountain-played: adfce60b2eaa54903ea189bed8a783bca609fa53
12431243
refs/heads/revert-22300-revert-22227-a-tall-white-fountain-played: 5f92040224df7dd4e618fdfb367349df64d8acad
12441244
refs/heads/swift-5.1-old-llvm-branch: 9cef8175146f25b72806154b8a0f4a3f52e3e400
1245-
refs/heads/swift-5.1-branch: 95ec05a87c6f4a468ba6d5bbcd728e799235ef2a
1245+
refs/heads/swift-5.1-branch: 3d776bc7a91662791b77726b248f513ed705a27e
12461246
refs/tags/swift-4.2.2-RELEASE: e429d1f1aaf59e69d38207a96e56265c7f6fccec
12471247
refs/tags/swift-5.0-DEVELOPMENT-SNAPSHOT-2019-02-02-a: 3e5a03d32ff3b1e9af90d6c1198c14f938379a6e
12481248
refs/tags/swift-5.0-DEVELOPMENT-SNAPSHOT-2019-02-03-a: 4591c933063ddcb0d6cd6d0cdd01086b2f9b244d

branches/swift-5.1-branch/include/swift/SIL/AbstractionPattern.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -565,11 +565,13 @@ class AbstractionPattern {
565565
case Kind::Type:
566566
case Kind::Discard: {
567567
auto type = getType();
568-
if (isa<ArchetypeType>(type) ||
569-
isa<DependentMemberType>(type) ||
568+
if (isa<DependentMemberType>(type) ||
570569
isa<GenericTypeParamType>(type)) {
571570
return true;
572571
}
572+
if (auto archetype = dyn_cast<ArchetypeType>(type)) {
573+
return !isa<OpaqueTypeArchetypeType>(archetype->getRoot());
574+
}
573575
return false;
574576
}
575577
default:

branches/swift-5.1-branch/lib/IRGen/DebugTypeInfo.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,15 @@ DebugTypeInfo DebugTypeInfo::getMetadata(swift::Type Ty, llvm::Type *StorageTy,
8080
Size size, Alignment align) {
8181
DebugTypeInfo DbgTy(Ty.getPointer(), StorageTy, size,
8282
align, true, false);
83-
assert(!DbgTy.isArchetype() && "type metadata cannot contain an archetype");
83+
assert(!DbgTy.isContextArchetype() && "type metadata cannot contain an archetype");
8484
return DbgTy;
8585
}
8686

8787
DebugTypeInfo DebugTypeInfo::getArchetype(swift::Type Ty, llvm::Type *StorageTy,
8888
Size size, Alignment align) {
8989
DebugTypeInfo DbgTy(Ty.getPointer(), StorageTy, size,
9090
align, true, true);
91-
assert(!DbgTy.isArchetype() && "type metadata cannot contain an archetype");
91+
assert(!DbgTy.isContextArchetype() && "type metadata cannot contain an archetype");
9292
return DbgTy;
9393
}
9494

@@ -107,7 +107,7 @@ DebugTypeInfo DebugTypeInfo::getGlobal(SILGlobalVariable *GV,
107107
DebugTypeInfo DbgTy(Type, StorageTy, size, align, hasDefaultAlignment(Type),
108108
false);
109109
assert(StorageTy && "StorageType is a nullptr");
110-
assert(!DbgTy.isArchetype() &&
110+
assert(!DbgTy.isContextArchetype() &&
111111
"type of global variable cannot be an archetype");
112112
assert(align.getValue() != 0);
113113
return DbgTy;
@@ -118,7 +118,7 @@ DebugTypeInfo DebugTypeInfo::getObjCClass(ClassDecl *theClass,
118118
Alignment align) {
119119
DebugTypeInfo DbgTy(theClass->getInterfaceType().getPointer(), StorageType,
120120
size, align, true, false);
121-
assert(!DbgTy.isArchetype() && "type of objc class cannot be an archetype");
121+
assert(!DbgTy.isContextArchetype() && "type of objc class cannot be an archetype");
122122
return DbgTy;
123123
}
124124

branches/swift-5.1-branch/lib/IRGen/DebugTypeInfo.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,12 @@ class DebugTypeInfo {
8080

8181
TypeDecl *getDecl() const;
8282

83-
// Determine whether this type is an Archetype itself.
84-
bool isArchetype() const {
85-
return Type->getWithoutSpecifierType()->is<ArchetypeType>();
83+
// Determine whether this type is an Archetype dependent on a generic context.
84+
bool isContextArchetype() const {
85+
if (auto archetype = Type->getWithoutSpecifierType()->getAs<ArchetypeType>()) {
86+
return !isa<OpaqueTypeArchetypeType>(archetype->getRoot());
87+
}
88+
return false;
8689
}
8790

8891
bool isNull() const { return Type == nullptr; }
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// RUN: %target-swift-frontend -emit-ir -verify %s
2+
3+
// rdar://problem/49818962
4+
func foo() -> some Collection {
5+
return [12,3]
6+
}
7+
8+
let a = foo()
9+
10+
print(a)

0 commit comments

Comments
 (0)