diff --git a/include/swift/Basic/LangOptions.h b/include/swift/Basic/LangOptions.h index 0d24bb497c510..8d64525ffa2bf 100644 --- a/include/swift/Basic/LangOptions.h +++ b/include/swift/Basic/LangOptions.h @@ -538,10 +538,6 @@ namespace swift { /// Disable constraint system performance hacks. bool DisableConstraintSolverPerformanceHacks = false; - /// Enable constraint solver support for experimental - /// operator protocol designator feature. - bool SolverEnableOperatorDesignatedTypes = false; - /// Enable experimental support for one-way constraints for the /// parameters of closures. bool EnableOneWayClosureParameters = false; diff --git a/include/swift/Option/FrontendOptions.td b/include/swift/Option/FrontendOptions.td index 8c2a727c4947b..a1fddc99263d2 100644 --- a/include/swift/Option/FrontendOptions.td +++ b/include/swift/Option/FrontendOptions.td @@ -480,10 +480,6 @@ def enable_operator_designated_types : Flag<["-"], "enable-operator-designated-types">, HelpText<"Enable operator designated types">; -def solver_enable_operator_designated_types : - Flag<["-"], "solver-enable-operator-designated-types">, - HelpText<"Enable operator designated types in constraint solver">; - def enable_invalid_ephemeralness_as_error : Flag<["-"], "enable-invalid-ephemeralness-as-error">, HelpText<"Diagnose invalid ephemeral to non-ephemeral conversions as errors">; diff --git a/include/swift/Sema/ConstraintSystem.h b/include/swift/Sema/ConstraintSystem.h index 0642dedac73ba..468ca1b6036ef 100644 --- a/include/swift/Sema/ConstraintSystem.h +++ b/include/swift/Sema/ConstraintSystem.h @@ -5032,8 +5032,6 @@ class ConstraintSystem { /// \returns The selected disjunction. Constraint *selectDisjunction(); - Constraint *selectApplyDisjunction(); - /// Solve the system of constraints generated from provided expression. /// /// \param target The target to generate constraints from. @@ -5293,19 +5291,6 @@ class ConstraintSystem { typedef std::function &options)> PartitionAppendCallback; - // Attempt to sort nominalTypes based on what we can discover about - // calls into the overloads in the disjunction that bindOverload is - // a part of. - void sortDesignatedTypes(SmallVectorImpl &nominalTypes, - Constraint *bindOverload); - - // Partition the choices in a disjunction based on those that match - // the designated types for the operator that the disjunction was - // formed for. - void partitionForDesignatedTypes(ArrayRef Choices, - ConstraintMatchLoop forEachChoice, - PartitionAppendCallback appendPartition); - // Partition the choices in the disjunction into groups that we will // iterate over in an order appropriate to attempt to stop before we // have to visit all of the options. diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index 538403e12514a..568c7a6aa7e65 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -742,8 +742,6 @@ static bool ParseTypeCheckerArgs(TypeCheckerOptions &Opts, ArgList &Args, // Always enable operator designated types for the standard library. Opts.EnableOperatorDesignatedTypes |= FrontendOpts.ParseStdlib; - Opts.SolverEnableOperatorDesignatedTypes |= - Args.hasArg(OPT_solver_enable_operator_designated_types); Opts.EnableOneWayClosureParameters |= Args.hasArg(OPT_experimental_one_way_closure_params); diff --git a/lib/Sema/CSSolver.cpp b/lib/Sema/CSSolver.cpp index 789e937ceb76a..bdc519dec4758 100644 --- a/lib/Sema/CSSolver.cpp +++ b/lib/Sema/CSSolver.cpp @@ -1929,30 +1929,6 @@ Constraint *ConstraintSystem::getUnboundBindOverloadDisjunction( return result->first; } -// Find a disjunction associated with an ApplicableFunction constraint -// where we have some information about all of the types of in the -// function application (even if we only know something about what the -// types conform to and not actually a concrete type). -Constraint *ConstraintSystem::selectApplyDisjunction() { - for (auto &constraint : InactiveConstraints) { - if (constraint.getKind() != ConstraintKind::ApplicableFunction) - continue; - - auto *applicable = &constraint; - if (haveTypeInformationForAllArguments( - applicable->getFirstType()->castTo())) { - auto *tyvar = applicable->getSecondType()->castTo(); - - // If we have created the disjunction for this apply, find it. - auto *disjunction = getUnboundBindOverloadDisjunction(tyvar); - if (disjunction) - return disjunction; - } - } - - return nullptr; -} - static bool isOperatorBindOverload(Constraint *bindOverload) { if (bindOverload->getKind() != ConstraintKind::BindOverload) return false; @@ -1965,165 +1941,6 @@ static bool isOperatorBindOverload(Constraint *bindOverload) { return funcDecl && funcDecl->getOperatorDecl(); } -// Given a bind overload constraint for an operator, return the -// protocol designated as the first place to look for overloads of the -// operator. -static ArrayRef -getOperatorDesignatedNominalTypes(Constraint *bindOverload) { - auto choice = bindOverload->getOverloadChoice(); - auto *funcDecl = cast(choice.getDecl()); - auto *operatorDecl = funcDecl->getOperatorDecl(); - return operatorDecl->getDesignatedNominalTypes(); -} - -void ConstraintSystem::sortDesignatedTypes( - SmallVectorImpl &nominalTypes, - Constraint *bindOverload) { - auto *tyvar = bindOverload->getFirstType()->castTo(); - auto applicableFns = getConstraintGraph().gatherConstraints( - tyvar, ConstraintGraph::GatheringKind::EquivalenceClass, - [](Constraint *match) { - return match->getKind() == ConstraintKind::ApplicableFunction; - }); - - // FIXME: This is not true when we run the constraint optimizer. - // assert(applicableFns.size() <= 1); - - // We have a disjunction for an operator but no application of it, - // so it's being passed as an argument. - if (applicableFns.size() == 0) - return; - - // FIXME: We have more than one applicable per disjunction as a - // result of merging disjunction type variables. We may want - // to rip that out at some point. - Constraint *foundApplicable = nullptr; - SmallVector, 2> argumentTypes; - for (auto *applicableFn : applicableFns) { - argumentTypes.clear(); - auto *fnTy = applicableFn->getFirstType()->castTo(); - ArgumentInfoCollector argInfo(*this, fnTy); - // Stop if we hit anything with concrete types or conformances to - // literals. - if (!argInfo.getTypes().empty() || !argInfo.getLiteralProtocols().empty()) { - foundApplicable = applicableFn; - break; - } - } - - if (!foundApplicable) - return; - - // FIXME: It would be good to avoid this redundancy. - auto *fnTy = foundApplicable->getFirstType()->castTo(); - ArgumentInfoCollector argInfo(*this, fnTy); - - size_t nextType = 0; - for (auto argType : argInfo.getTypes()) { - auto *nominal = argType->getAnyNominal(); - for (size_t i = nextType; i < nominalTypes.size(); ++i) { - if (nominal == nominalTypes[i]) { - std::swap(nominalTypes[nextType], nominalTypes[i]); - ++nextType; - break; - } else if (auto *protoDecl = dyn_cast(nominalTypes[i])) { - if (TypeChecker::conformsToProtocol(argType, protoDecl, DC)) { - std::swap(nominalTypes[nextType], nominalTypes[i]); - ++nextType; - break; - } - } - } - } - - if (nextType + 1 >= nominalTypes.size()) - return; - - for (auto *protocol : argInfo.getLiteralProtocols()) { - auto defaultType = TypeChecker::getDefaultType(protocol, DC); - // ExpressibleByNilLiteral does not have a default type. - if (!defaultType) - continue; - auto *nominal = defaultType->getAnyNominal(); - for (size_t i = nextType + 1; i < nominalTypes.size(); ++i) { - if (nominal == nominalTypes[i]) { - std::swap(nominalTypes[nextType], nominalTypes[i]); - ++nextType; - break; - } - } - } -} - -void ConstraintSystem::partitionForDesignatedTypes( - ArrayRef Choices, ConstraintMatchLoop forEachChoice, - PartitionAppendCallback appendPartition) { - - auto types = getOperatorDesignatedNominalTypes(Choices[0]); - if (types.empty()) - return; - - SmallVector designatedNominalTypes(types.begin(), - types.end()); - - if (designatedNominalTypes.size() > 1) - sortDesignatedTypes(designatedNominalTypes, Choices[0]); - - SmallVector, 4> definedInDesignatedType; - SmallVector, 4> definedInExtensionOfDesignatedType; - - auto examineConstraint = - [&](unsigned constraintIndex, Constraint *constraint) -> bool { - auto *decl = constraint->getOverloadChoice().getDecl(); - auto *funcDecl = cast(decl); - - auto *parentDC = funcDecl->getParent(); - auto *parentDecl = parentDC->getSelfNominalTypeDecl(); - - // Skip anything not defined in a nominal type. - if (!parentDecl) - return false; - - for (auto designatedTypeIndex : indices(designatedNominalTypes)) { - auto *designatedNominal = - designatedNominalTypes[designatedTypeIndex]; - - if (parentDecl != designatedNominal) - continue; - - auto &constraints = - isa(parentDC) - ? definedInExtensionOfDesignatedType[designatedTypeIndex] - : definedInDesignatedType[designatedTypeIndex]; - - constraints.push_back(constraintIndex); - return true; - } - - return false; - }; - - definedInDesignatedType.resize(designatedNominalTypes.size()); - definedInExtensionOfDesignatedType.resize(designatedNominalTypes.size()); - - forEachChoice(Choices, examineConstraint); - - // Now collect the overload choices that are defined within the type - // that was designated in the operator declaration. - // Add partitions for each of the overloads we found in types that - // were designated as part of the operator declaration. - for (auto designatedTypeIndex : indices(designatedNominalTypes)) { - if (designatedTypeIndex < definedInDesignatedType.size()) { - auto &primary = definedInDesignatedType[designatedTypeIndex]; - appendPartition(primary); - } - if (designatedTypeIndex < definedInExtensionOfDesignatedType.size()) { - auto &secondary = definedInExtensionOfDesignatedType[designatedTypeIndex]; - appendPartition(secondary); - } - } -} - // Performance hack: if there are two generic overloads, and one is // more specialized than the other, prefer the more-specialized one. static Constraint *tryOptimizeGenericDisjunction( @@ -2266,8 +2083,7 @@ void ConstraintSystem::partitionDisjunction( } // Partition SIMD operators. - if (!getASTContext().TypeCheckerOpts.SolverEnableOperatorDesignatedTypes && - isOperatorBindOverload(Choices[0])) { + if (isOperatorBindOverload(Choices[0])) { forEachChoice(Choices, [&](unsigned index, Constraint *constraint) -> bool { if (!isOperatorBindOverload(constraint)) return false; @@ -2291,11 +2107,6 @@ void ConstraintSystem::partitionDisjunction( } }; - if (getASTContext().TypeCheckerOpts.SolverEnableOperatorDesignatedTypes && - isOperatorBindOverload(Choices[0])) { - partitionForDesignatedTypes(Choices, forEachChoice, appendPartition); - } - SmallVector everythingElse; // Gather the remaining options. forEachChoice(Choices, [&](unsigned index, Constraint *constraint) -> bool { @@ -2320,17 +2131,6 @@ Constraint *ConstraintSystem::selectDisjunction() { if (disjunctions.empty()) return nullptr; - // Attempt apply disjunctions first. When we have operators with - // designated types, this is important, because it allows us to - // select all the preferred operator overloads prior to other - // disjunctions that we may not be able to short-circuit, allowing - // us to eliminate behavior that is exponential in the number of - // operators in the expression. - if (getASTContext().TypeCheckerOpts.SolverEnableOperatorDesignatedTypes) { - if (auto *disjunction = selectApplyDisjunction()) - return disjunction; - } - if (auto *disjunction = selectBestBindingDisjunction(*this, disjunctions)) return disjunction; diff --git a/lib/Sema/CSStep.cpp b/lib/Sema/CSStep.cpp index 26fff0c7eebab..10636456a5a1c 100644 --- a/lib/Sema/CSStep.cpp +++ b/lib/Sema/CSStep.cpp @@ -660,8 +660,7 @@ bool DisjunctionStep::shortCircuitDisjunctionAt( if (currentChoice->getKind() == ConstraintKind::BindOverload && isSIMDOperator(currentChoice->getOverloadChoice().getDecl()) && lastSuccessfulChoice->getKind() == ConstraintKind::BindOverload && - !isSIMDOperator(lastSuccessfulChoice->getOverloadChoice().getDecl()) && - !ctx.TypeCheckerOpts.SolverEnableOperatorDesignatedTypes) { + !isSIMDOperator(lastSuccessfulChoice->getOverloadChoice().getDecl())) { return true; } diff --git a/test/Constraints/add_with_nil.swift b/test/Constraints/add_with_nil.swift index 30121abdfb20a..0a5e9b1eabc22 100644 --- a/test/Constraints/add_with_nil.swift +++ b/test/Constraints/add_with_nil.swift @@ -1,4 +1,4 @@ -// RUN: %target-typecheck-verify-swift -swift-version 5 -solver-enable-operator-designated-types -solver-disable-shrink -disable-constraint-solver-performance-hacks +// RUN: %target-typecheck-verify-swift -swift-version 5 func test(_ x: Int) -> Int { return x + nil diff --git a/test/attr/attr_implements_fp.swift b/test/attr/attr_implements_fp.swift index 21096fc433339..b464ee23d43e9 100644 --- a/test/attr/attr_implements_fp.swift +++ b/test/attr/attr_implements_fp.swift @@ -1,6 +1,6 @@ // RUN: %empty-directory(%t) // RUN: echo 'main()' >%t/main.swift -// RUN: %target-swiftc_driver -o %t/a.out %s %t/main.swift -Xfrontend -enable-operator-designated-types -Xfrontend -solver-enable-operator-designated-types +// RUN: %target-swiftc_driver -o %t/a.out %s %t/main.swift // RUN: %target-codesign %t/a.out // RUN: %target-run %t/a.out | %FileCheck %s // REQUIRES: executable_test @@ -13,7 +13,7 @@ public var comparedAsCauxmparablesCount : Int = 0 public var comparedAsFauxtsCount : Int = 0 -infix operator .< : ComparisonPrecedence, BinaryFauxtingPoint, Cauxmparable +infix operator .< : ComparisonPrecedence public protocol Cauxmparable { static func .< (lhs: Self, rhs: Self) -> Bool diff --git a/test/attr/attr_implements_serial.swift b/test/attr/attr_implements_serial.swift index e388590ed4a58..944e40d5bd032 100644 --- a/test/attr/attr_implements_serial.swift +++ b/test/attr/attr_implements_serial.swift @@ -1,6 +1,6 @@ // RUN: %empty-directory(%t) // RUN: echo 'client()' >%t/main.swift -// RUN: %target-build-swift-dylib(%t/%target-library-name(AttrImplFP)) -module-name AttrImplFP -emit-module -emit-module-path %t/AttrImplFP.swiftmodule %S/attr_implements_fp.swift -Xfrontend -enable-operator-designated-types -Xfrontend -solver-enable-operator-designated-types +// RUN: %target-build-swift-dylib(%t/%target-library-name(AttrImplFP)) -module-name AttrImplFP -emit-module -emit-module-path %t/AttrImplFP.swiftmodule %S/attr_implements_fp.swift // RUN: %target-build-swift -I %t -o %t/a.out %s %t/main.swift -L %t %target-rpath(%t) -lAttrImplFP // RUN: %target-codesign %t/a.out // RUN: %target-codesign %t/%target-library-name(AttrImplFP) diff --git a/validation-test/Sema/type_checker_perf/fast/expression_too_complex_4.swift b/validation-test/Sema/type_checker_perf/slow/expression_too_complex_4.swift similarity index 73% rename from validation-test/Sema/type_checker_perf/fast/expression_too_complex_4.swift rename to validation-test/Sema/type_checker_perf/slow/expression_too_complex_4.swift index b9dfd039243a9..f404bb6e35d1c 100644 --- a/validation-test/Sema/type_checker_perf/fast/expression_too_complex_4.swift +++ b/validation-test/Sema/type_checker_perf/slow/expression_too_complex_4.swift @@ -1,8 +1,9 @@ -// RUN: %target-typecheck-verify-swift -swift-version 4 -solver-expression-time-threshold=1 -solver-disable-shrink -disable-constraint-solver-performance-hacks -solver-enable-operator-designated-types +// RUN: %target-typecheck-verify-swift -swift-version 4 -solver-expression-time-threshold=1 // REQUIRES: tools-release,no_asan func test(_ i: Int, _ j: Int) -> Int { return 1 + (((i >> 1) + (i >> 2) + (i >> 3) + (i >> 4) << 1) << 1) & 0x40 + 1 + (((i >> 1) + (i >> 2) + (i >> 3) + (i >> 4) << 1) << 1) & 0x40 + 1 + (((i >> 1) + (i >> 2) + (i >> 3) + (i >> 4) << 1) << 1) & 0x40 + // expected-error@-1 {{the compiler is unable to type-check this expression in reasonable time}} } diff --git a/test/Constraints/fast-operator-typechecking.swift b/validation-test/Sema/type_checker_perf/slow/fast-operator-typechecking.swift similarity index 74% rename from test/Constraints/fast-operator-typechecking.swift rename to validation-test/Sema/type_checker_perf/slow/fast-operator-typechecking.swift index c51bb0331d9c5..20b9e029a84d4 100644 --- a/test/Constraints/fast-operator-typechecking.swift +++ b/validation-test/Sema/type_checker_perf/slow/fast-operator-typechecking.swift @@ -1,8 +1,9 @@ -// RUN: %target-typecheck-verify-swift -swift-version 5 -solver-enable-operator-designated-types -solver-disable-shrink -disable-constraint-solver-performance-hacks +// RUN: %target-typecheck-verify-swift -swift-version 5 -solver-expression-time-threshold=1 // rdar://problem/32998180 func checksum(value: UInt16) -> UInt16 { var checksum = (((value >> 2) ^ (value >> 8) ^ (value >> 12) ^ (value >> 14)) & 0x01) << 1 + // expected-error@-1 {{the compiler is unable to type-check this expression in reasonable time}} checksum |= (((value) ^ (value >> UInt16(4)) ^ (value >> UInt16(6)) ^ (value >> UInt16(10))) & 0x01) checksum ^= 0x02 return checksum @@ -17,4 +18,5 @@ func f(tail: UInt64, byteCount: UInt64) { func size(count: Int) { // Size of the buffer we need to allocate let _ = count * MemoryLayout.size * (4 + 3 + 3 + 2 + 4) + // expected-error@-1 {{the compiler is unable to type-check this expression in reasonable time}} } diff --git a/validation-test/Sema/type_checker_perf/fast/rdar17170728.swift b/validation-test/Sema/type_checker_perf/slow/rdar17170728.swift similarity index 69% rename from validation-test/Sema/type_checker_perf/fast/rdar17170728.swift rename to validation-test/Sema/type_checker_perf/slow/rdar17170728.swift index aeb136a7992b0..62c2bb2ea367b 100644 --- a/validation-test/Sema/type_checker_perf/fast/rdar17170728.swift +++ b/validation-test/Sema/type_checker_perf/slow/rdar17170728.swift @@ -1,10 +1,11 @@ -// RUN: %target-typecheck-verify-swift -solver-expression-time-threshold=1 -solver-disable-shrink -disable-constraint-solver-performance-hacks -solver-enable-operator-designated-types +// RUN: %target-typecheck-verify-swift -solver-expression-time-threshold=1 // REQUIRES: tools-release,no_asan let i: Int? = 1 let j: Int? let k: Int? = 2 +// expected-error@+1 {{the compiler is unable to type-check this expression in reasonable time}} let _ = [i, j, k].reduce(0 as Int?) { $0 != nil && $1 != nil ? $0! + $1! : ($0 != nil ? $0! : ($1 != nil ? $1! : nil)) } diff --git a/validation-test/Sema/type_checker_perf/fast/rdar19357292.swift b/validation-test/Sema/type_checker_perf/slow/rdar19357292.swift similarity index 69% rename from validation-test/Sema/type_checker_perf/fast/rdar19357292.swift rename to validation-test/Sema/type_checker_perf/slow/rdar19357292.swift index 41b9ae8518d13..308029540bdaf 100644 --- a/validation-test/Sema/type_checker_perf/fast/rdar19357292.swift +++ b/validation-test/Sema/type_checker_perf/slow/rdar19357292.swift @@ -1,8 +1,9 @@ -// RUN: %target-typecheck-verify-swift -solver-expression-time-threshold=1 -solver-disable-shrink -disable-constraint-solver-performance-hacks -solver-enable-operator-designated-types +// RUN: %target-typecheck-verify-swift -solver-expression-time-threshold=1 // REQUIRES: tools-release,no_asan func test(strings: [String]) { for string in strings { let _ = string.split(omittingEmptySubsequences: false) { $0 == "C" || $0 == "D" || $0 == "H" || $0 == "S"} + // expected-error@-1 {{the compiler is unable to type-check this expression in reasonable time}} } } diff --git a/validation-test/Sema/type_checker_perf/fast/rdar19836070.swift b/validation-test/Sema/type_checker_perf/slow/rdar19836070.swift similarity index 62% rename from validation-test/Sema/type_checker_perf/fast/rdar19836070.swift rename to validation-test/Sema/type_checker_perf/slow/rdar19836070.swift index b6f7dd0106422..1ff690b029c63 100644 --- a/validation-test/Sema/type_checker_perf/fast/rdar19836070.swift +++ b/validation-test/Sema/type_checker_perf/slow/rdar19836070.swift @@ -1,6 +1,7 @@ -// RUN: %target-typecheck-verify-swift -solver-expression-time-threshold=1 -solver-disable-shrink -disable-constraint-solver-performance-hacks -solver-enable-operator-designated-types +// RUN: %target-typecheck-verify-swift -solver-expression-time-threshold=1 // REQUIRES: tools-release,no_asan +// expected-error@+1 {{the compiler is unable to type-check this expression in reasonable time}} let _: (Character) -> Bool = { c in ("a" <= c && c <= "z") || ("A" <= c && c <= "Z") || c == "_" } diff --git a/validation-test/Sema/type_checker_perf/fast/rdar22770433.swift b/validation-test/Sema/type_checker_perf/slow/rdar22770433.swift similarity index 69% rename from validation-test/Sema/type_checker_perf/fast/rdar22770433.swift rename to validation-test/Sema/type_checker_perf/slow/rdar22770433.swift index 430b4f5caba2d..f063e685689de 100644 --- a/validation-test/Sema/type_checker_perf/fast/rdar22770433.swift +++ b/validation-test/Sema/type_checker_perf/slow/rdar22770433.swift @@ -1,7 +1,8 @@ -// RUN: %target-typecheck-verify-swift -solver-expression-time-threshold=1 -solver-disable-shrink -disable-constraint-solver-performance-hacks -solver-enable-operator-designated-types +// RUN: %target-typecheck-verify-swift -solver-expression-time-threshold=1 // REQUIRES: tools-release,no_asan func test(n: Int) -> Int { + // expected-error@+1 {{the compiler is unable to type-check this expression in reasonable time}} return n == 0 ? 0 : (0.. 0 && $1 % 2 == 0) ? ((($0 + $1) - ($0 + $1)) / ($1 - $0)) + (($0 + $1) / ($1 - $0)) : $0 } diff --git a/validation-test/Sema/type_checker_perf/fast/rdar23429943.swift b/validation-test/Sema/type_checker_perf/slow/rdar23429943.swift similarity index 63% rename from validation-test/Sema/type_checker_perf/fast/rdar23429943.swift rename to validation-test/Sema/type_checker_perf/slow/rdar23429943.swift index cf634beccefbd..7f3efc941f47e 100644 --- a/validation-test/Sema/type_checker_perf/fast/rdar23429943.swift +++ b/validation-test/Sema/type_checker_perf/slow/rdar23429943.swift @@ -1,6 +1,7 @@ -// RUN: %target-typecheck-verify-swift -solver-expression-time-threshold=1 -solver-disable-shrink -disable-constraint-solver-performance-hacks -solver-enable-operator-designated-types +// RUN: %target-typecheck-verify-swift -solver-expression-time-threshold=1 // REQUIRES: tools-release,no_asan +// expected-error@+1 {{the compiler is unable to type-check this expression in reasonable time}} let _ = [0].reduce([Int]()) { return $0.count == 0 && ($1 == 0 || $1 == 2 || $1 == 3) ? [] : $0 + [$1] } diff --git a/validation-test/Sema/type_checker_perf/slow/rdar25866240.gyb b/validation-test/Sema/type_checker_perf/slow/rdar25866240.gyb new file mode 100644 index 0000000000000..d42e1bb7a421c --- /dev/null +++ b/validation-test/Sema/type_checker_perf/slow/rdar25866240.gyb @@ -0,0 +1,26 @@ +// RUN: %target-typecheck-verify-swift -solver-expression-time-threshold=1 +// REQUIRES: asserts,no_asan + +func f( + collection1: [String], + collection2: [String], + collection3: [String], + collection4: [String], + collection5: [String], + collection6: [String], + collection7: [String], + collection8: [String], + collection9: [String], + collection10: [String] +) { + _ = collection1 + + collection2 + + collection3 + + collection4 + + collection5 + + collection6 + + collection7 + + collection8 + + collection9 + + collection10 +} diff --git a/validation-test/Sema/type_checker_perf/slow/rdar25866240.swift.gyb b/validation-test/Sema/type_checker_perf/slow/rdar25866240.swift.gyb deleted file mode 100644 index 3b631b01c1616..0000000000000 --- a/validation-test/Sema/type_checker_perf/slow/rdar25866240.swift.gyb +++ /dev/null @@ -1,11 +0,0 @@ -// RUN: %scale-test --begin 2 --end 10 --step 1 --select NumConstraintScopes %s -Xfrontend=-solver-disable-shrink -Xfrontend=-disable-constraint-solver-performance-hacks -Xfrontend=-solver-enable-operator-designated-types -Xfrontend=-solver-expression-time-threshold=1 -// REQUIRES: asserts,no_asan - -func f( -%for i in range(N): - collection${i}: [String], -%end - collection${N+1}: [String] -) { - _ = ${' + '.join("collection%s" % i for i in range(N))} -} diff --git a/validation-test/Sema/type_checker_perf/fast/rdar31439825.swift b/validation-test/Sema/type_checker_perf/slow/rdar31439825.swift similarity index 53% rename from validation-test/Sema/type_checker_perf/fast/rdar31439825.swift rename to validation-test/Sema/type_checker_perf/slow/rdar31439825.swift index 9802d55b497f8..4a8d06390b6e6 100644 --- a/validation-test/Sema/type_checker_perf/fast/rdar31439825.swift +++ b/validation-test/Sema/type_checker_perf/slow/rdar31439825.swift @@ -1,6 +1,7 @@ -// RUN: %target-typecheck-verify-swift -solver-expression-time-threshold=1 -solver-disable-shrink -disable-constraint-solver-performance-hacks -solver-enable-operator-designated-types +// RUN: %target-typecheck-verify-swift -solver-expression-time-threshold=1 // REQUIRES: tools-release,no_asan let a = 1 _ = -a + -a - -a + -a - -a +// expected-error@-1 {{the compiler is unable to type-check this expression in reasonable time}} diff --git a/validation-test/Sema/type_checker_perf/fast/rdar31742586.swift b/validation-test/Sema/type_checker_perf/slow/rdar31742586.swift similarity index 61% rename from validation-test/Sema/type_checker_perf/fast/rdar31742586.swift rename to validation-test/Sema/type_checker_perf/slow/rdar31742586.swift index 92eb51d065103..0cc33ce8253cf 100644 --- a/validation-test/Sema/type_checker_perf/fast/rdar31742586.swift +++ b/validation-test/Sema/type_checker_perf/slow/rdar31742586.swift @@ -1,6 +1,7 @@ -// RUN: %target-typecheck-verify-swift -solver-expression-time-threshold=1 -solver-disable-shrink -disable-constraint-solver-performance-hacks -solver-enable-operator-designated-types +// RUN: %target-typecheck-verify-swift -solver-expression-time-threshold=1 // REQUIRES: tools-release,no_asan func rdar31742586() -> Double { return -(1 + 2) + -(3 + 4) + 5 - (-(1 + 2) + -(3 + 4) + 5) + // expected-error@-1 {{the compiler is unable to type-check this expression in reasonable time}} } diff --git a/validation-test/Sema/type_checker_perf/fast/rdar32998180.swift b/validation-test/Sema/type_checker_perf/slow/rdar32998180.swift similarity index 73% rename from validation-test/Sema/type_checker_perf/fast/rdar32998180.swift rename to validation-test/Sema/type_checker_perf/slow/rdar32998180.swift index 3b4fcc831cfc1..0c4830cb2c6cd 100644 --- a/validation-test/Sema/type_checker_perf/fast/rdar32998180.swift +++ b/validation-test/Sema/type_checker_perf/slow/rdar32998180.swift @@ -1,8 +1,9 @@ -// RUN: %target-typecheck-verify-swift -solver-expression-time-threshold=1 -solver-disable-shrink -disable-constraint-solver-performance-hacks -solver-enable-operator-designated-types +// RUN: %target-typecheck-verify-swift -solver-expression-time-threshold=1 // REQUIRES: tools-release,no_asan func rdar32998180(value: UInt16) -> UInt16 { let result = ((((value >> 1) ^ (value >> 1) ^ (value >> 1) ^ (value >> 1)) & 1) << 1) | (((((value >> 1) ^ (value >> 1) ^ (value >> 1) ^ (value >> 1)) & 1) << 1) << 1) + // expected-error@-1 {{the compiler is unable to type-check this expression in reasonable time}} return result } diff --git a/validation-test/Sema/type_checker_perf/fast/rdar35213699.swift b/validation-test/Sema/type_checker_perf/slow/rdar35213699.swift similarity index 61% rename from validation-test/Sema/type_checker_perf/fast/rdar35213699.swift rename to validation-test/Sema/type_checker_perf/slow/rdar35213699.swift index 8c12b9ac6bd00..5d89ab1541a89 100644 --- a/validation-test/Sema/type_checker_perf/fast/rdar35213699.swift +++ b/validation-test/Sema/type_checker_perf/slow/rdar35213699.swift @@ -1,7 +1,8 @@ -// RUN: %target-typecheck-verify-swift -solver-expression-time-threshold=1 -solver-disable-shrink -disable-constraint-solver-performance-hacks -solver-enable-operator-designated-types +// RUN: %target-typecheck-verify-swift -solver-expression-time-threshold=1 // REQUIRES: tools-release,no_asan func test() { let _: UInt = 1 * 2 + 3 * 4 + 5 * 6 + 7 * 8 + 9 * 10 + 11 * 12 + 13 * 14 + // expected-error@-1 {{the compiler is unable to type-check this expression in reasonable time}} }