File tree Expand file tree Collapse file tree 2 files changed +24
-8
lines changed
validation-test/Sema/type_checker_perf/fast Expand file tree Collapse file tree 2 files changed +24
-8
lines changed Original file line number Diff line number Diff line change @@ -224,23 +224,20 @@ void ConstraintSystem::PotentialBindings::addPotentialBinding(
224
224
225
225
bool ConstraintSystem::PotentialBindings::isViable (
226
226
PotentialBinding &binding) const {
227
- // Prevent against checking against the same bound generic type
227
+ // Prevent against checking against the same opened nominal type
228
228
// over and over again. Doing so means redundant work in the best
229
229
// case. In the worst case, we'll produce lots of duplicate solutions
230
230
// for this constraint system, which is problematic for overload
231
231
// resolution.
232
232
auto type = binding.BindingType ;
233
233
if (type->hasTypeVariable ()) {
234
- auto *BGT = type->getAs <BoundGenericType> ();
235
- if (!BGT )
234
+ auto *NTD = type->getAnyNominal ();
235
+ if (!NTD )
236
236
return true ;
237
237
238
238
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)
244
241
return false ;
245
242
}
246
243
}
Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments