Skip to content

Commit bd0ea6b

Browse files
committed
---
yaml --- r: 345083 b: refs/heads/master c: fd38724 h: refs/heads/master i: 345081: 57b5d7a 345079: b81b73a
1 parent 459430e commit bd0ea6b

File tree

3 files changed

+25
-9
lines changed

3 files changed

+25
-9
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: a1a71acd8cc7d859975dbc27592564d0cbfa4f4b
2+
refs/heads/master: fd3872444fbebde0261ae6af025ba0ac1de0f3b3
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/lib/Sema/CSBindings.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -224,23 +224,20 @@ void ConstraintSystem::PotentialBindings::addPotentialBinding(
224224

225225
bool ConstraintSystem::PotentialBindings::isViable(
226226
PotentialBinding &binding) const {
227-
// Prevent against checking against the same bound generic type
227+
// Prevent against checking against the same opened nominal type
228228
// over and over again. Doing so means redundant work in the best
229229
// case. In the worst case, we'll produce lots of duplicate solutions
230230
// for this constraint system, which is problematic for overload
231231
// resolution.
232232
auto type = binding.BindingType;
233233
if (type->hasTypeVariable()) {
234-
auto *BGT = type->getAs<BoundGenericType>();
235-
if (!BGT)
234+
auto *NTD = type->getAnyNominal();
235+
if (!NTD)
236236
return true;
237237

238238
for (auto &existing : Bindings) {
239-
auto existingBGT = existing.BindingType->getAs<BoundGenericType>();
240-
if (!existingBGT)
241-
continue;
242-
243-
if (BGT != existingBGT && BGT->getDecl() == existingBGT->getDecl())
239+
auto *existingNTD = existing.BindingType->getAnyNominal();
240+
if (existingNTD && NTD == existingNTD)
244241
return false;
245242
}
246243
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// RUN: %scale-test --begin 1 --end 30 --step 1 --select incrementScopeCounter %s
2+
// REQUIRES: OS=macosx
3+
// REQUIRES: asserts
4+
5+
struct A<T> {
6+
struct B {
7+
init(_: T) {}
8+
}
9+
}
10+
11+
public func test(_ fn: @escaping () -> Void) {}
12+
test {
13+
let _ = [
14+
%for i in range(0, N):
15+
A.B(1),
16+
%end
17+
A.B(1.0)
18+
]
19+
}

0 commit comments

Comments
 (0)