Commit Graph

817 Commits

Author SHA1 Message Date
zoecarver
21192904ba [cxx-interop][nfc] Add flag cxx-interop-getters-setters-as-properties.
This is causing problems in certain cases, disabling by default.
2022-04-20 17:32:26 -07:00
Pavel Yaskevich
6db0001863 [TypeChecker] NFC: Remove -experimental-multi-statement-closures flag
SE-0326 has been enabled by default, so this flag is no longer necessary.
2022-04-20 10:40:27 -07:00
Doug Gregor
7a724c4586 Add frontend flag -swift-concurrency={off|limited|on}
Replace `-warn-concurrency` with a more granular option
`-swift-concurrency=`, where the developer can select one of three
different "modes":

* `off` disables `Sendable` checking for most cases. (This is the Swift
5.5 and Swift 5.6 behavior.)
* `limited` enables `Sendable` checking within code that has adopted
Swift concurrency. (This is currently the default behavior.)
* `on` enables `Sendable` and other concurrency checking throughout
the module. (This is equivalent to `-warn-concurrency` now).

There is currently no distinction between `off` and `limited`. That
will come soon.

Implements the flag part of rdar://91930849.
2022-04-18 18:12:10 -07:00
Hamish Knight
63b8db1659 Start using '-enable-bare-slash-regex'
Change the flag to imply
'-enable-experimental-string-processing', and
and update some tests to start using it.
2022-04-12 16:03:47 +01:00
Pavel Yaskevich
f7253f253e Merge pull request #42228 from xedin/enable-se-0347-by-default
[TypeChecker] SE-0347: Enable type inference from default expressions
2022-04-08 16:10:20 -07:00
Pavel Yaskevich
b03021dbb7 [TypeChecker] SE-0347: Enable type inference from default expressions 2022-04-06 15:03:00 -07:00
Slava Pestov
1bf248e374 Enable parameterized protocols by default, and add new staging flag for parameterized existentials 2022-04-06 17:30:10 -04:00
swift-ci
882edde92f Merge pull request #41966 from rxwei/se-0348-if-approved
[ResultBuilders] Enable SE-0348 `buildPartialBlock` by default.
2022-04-04 21:21:19 -07:00
Richard Wei
065ac52c0d Add frontend flag -disable-implicit-string-processing-module-import.
We add a new flag to disable the implicit import of `_StringProcessing`, similar to `-disable-implicit-concurrency-module-import`. We need this to build `_RegexParser` when `-enable-experimental-string-processing` is enabled by default, because `_StringProcessing` currently imports `_RegexParser` publicly (non-implementation-only).
2022-04-04 13:55:47 -07:00
Evan Wilde
2eb801145e Merge branch 'main' into ewilde/async-main-resolution 2022-04-02 16:15:10 -07:00
Evan Wilde
da0a3311a5 Add -async-main flag to favor asynchronous main
This flag biases the overload checker in favor of selecting an
asynchronous main function over a synchronous main. If no asynchronous
main function exists, a synchronous one will still be selected.
Likewise, if the flag is not passed and there are only asynchronous main
functions available, the most specific asynchronous main function will
still be selected.
2022-04-02 16:14:01 -07:00
Slava Pestov
703d89c8bd Turn off the GenericSignatureBuilder
The Requirement Machine has been enabled in 'verify' mode for a while,
where we run both the GenericSignatureBuilder and Requirement Machine
minimization algorithm and compare the results, with the
GenericSignatureBuilder being used to emit diagnostics.

Now, it's time to flip the flags to 'enabled' mode, where the
GenericSignatureBuilder doesn't run at all, and the Requirement Machine
emits diagnostics. This finally allows us to realize the correctness
and performance gains from using the Requirement Machine.

See https://forums.swift.org/t/the-requirement-machine-a-new-generics-implementation-based-on-term-rewriting/55601/9
for details.

Correctness:

- https://bugs.swift.org/browse/SR-7353
- https://bugs.swift.org/browse/SR-9595
- https://bugs.swift.org/browse/SR-10532
- https://bugs.swift.org/browse/SR-10752
- https://bugs.swift.org/browse/SR-11100
- https://bugs.swift.org/browse/SR-11532
- https://bugs.swift.org/browse/SR-11997
- https://bugs.swift.org/browse/SR-12120
- https://bugs.swift.org/browse/SR-12736
- https://bugs.swift.org/browse/SR-12980
- https://bugs.swift.org/browse/SR-13018
- https://bugs.swift.org/browse/SR-13491
- https://bugs.swift.org/browse/SR-13502
- https://bugs.swift.org/browse/SR-14484
- https://bugs.swift.org/browse/SR-14485
- https://bugs.swift.org/browse/SR-14659
- https://bugs.swift.org/browse/SR-14776
- https://bugs.swift.org/browse/SR-14917
- https://bugs.swift.org/browse/SR-15009
- https://bugs.swift.org/browse/SR-15790
- https://bugs.swift.org/browse/SR-15920
- rdar://25065503
- rdar://39225307
- rdar://44590919
- rdar://45957015
- rdar://50169558
- rdar://51068593
- rdar://52921168
- rdar://54394068
- rdar://55758433
- rdar://58455439
- rdar://59132837
- rdar://62894047
- rdar://64953119
- rdar://65015626
- rdar://65558829
- rdar://68084643
- rdar://68376692
- rdar://75329340
- rdar://76646764
- rdar://77683844
- rdar://77794156
- rdar://78233378
- rdar://78481510
- rdar://78643612
- rdar://80820294
- rdar://81276358
- rdar://81425392
- rdar://83308672
- rdar://83373331
- rdar://83848546
- rdar://83955123
- rdar://88514540
- rdar://89641532
- rdar://90264856
- rdar://90343419

Performance:

- rdar://33654588
- rdar://47821930
- rdar://51908331
- rdar://59037195
- rdar://65131776
- rdar://73771235
- rdar://75188696

GSB crashes with no reduced test case that are likely fixed:

- https://bugs.swift.org/browse/SR-4872
- rdar://32144681
- rdar://42376632
- rdar://46270030
- rdar://47199993
- rdar://48648900
- rdar://49535930
- rdar://49712445
- rdar://49712637
- rdar://49713096
- rdar://49713107
- rdar://60334839
- rdar://66593156
- rdar://68982368
- rdar://76706682
- rdar://77794745
- rdar://84724541
2022-04-02 01:55:21 -04:00
Artem Chikin
aaee1c4bcf Merge pull request #42140 from artemcm/EnableRegexLiteralFlag
Add support for `-enable-regex-literals` flag
2022-04-01 15:38:45 -07:00
Artem Chikin
b04ae26391 Add support for -enable-regex-literals flag
- Add driver and frontend option
- Add LangOptions entry
- Ensure driver propagates flag to frontends
- Add feature to `features.json`

Part of rdar://91119995
2022-04-01 12:14:28 -07:00
Slava Pestov
b90d584128 Merge pull request #42111 from slavapestov/rqm-abstract-signatures-enable
LangOptions: Change default for RequirementMachineAbstractSignatures from Verify to Enabled
2022-03-31 21:24:20 -04:00
Xi Ge
91c4f17b35 Frontend: flip the default of whether importing SPI_AVAILABLE from clang 2022-03-31 09:43:13 -07:00
Slava Pestov
a852b58e6c LangOptions: Change default for RequirementMachineAbstractSignatures from Verify to Enabled
We've only seen false positives from verification here, and this request
doesn't emit diagnostics.
2022-03-31 11:21:22 -04:00
Slava Pestov
132334cda9 RequirementMachine: Add debugging flag to disable re-using requirement machines 2022-03-27 11:54:28 -04:00
Slava Pestov
cdcc8ed8fc RequirementMachine: Enable loop normalization by default 2022-03-26 22:12:12 -04:00
Anthony Latsis
38e48ac15d TypeWitnessSystem: Disable by default 2022-03-25 08:45:54 +03:00
Doug Gregor
c4e6e6d105 Eliminate the EnableExperimentalDistributed language option.
Nothing is using it because this feature is enabled by default.
2022-03-24 16:00:26 -07:00
Slava Pestov
5c5d2eadf6 Merge pull request #41945 from slavapestov/rqm-split-concrete-equiv-class-improvements
RequirementMachine: Improve the 'split concrete equivalence classes' hack a bit
2022-03-22 20:59:07 -04:00
Richard Wei
335b766b25 [ResultBuilders] Enable SE-0348 buildPartialBlock by default.
Enables SE-0348 `buildPartialBlock` feature by default. The frontend flag is kept for compatibility with existing clients, but is now ineffective.

Also includes some improved error messages for invalid result builder call sites.
2022-03-22 16:26:50 -07:00
Slava Pestov
9ccdd15d58 RequirementMachine: Add upper bound on number of attempts at splitting concrete equivalence classes 2022-03-22 15:02:06 -04:00
Andrew Trick
406aa86d2e Merge pull request #41557 from atrick/addrlower-update
Update and reimplement AddressLowering pass (for SIL opaque values).
2022-03-21 22:15:06 -07:00
Slava Pestov
b93717cbae RequirementMachine: Enable flags directly in LangOptions
This enables requirement machine minimization for all tools (SourceKit, etc)
not just the frontend.
2022-03-18 15:19:57 -04:00
Slava Pestov
e6d1ef9f6d Merge pull request #41868 from slavapestov/rqm-opaque-archetypes
RequirementMachine: Opaque archetype support (sort of)
2022-03-17 23:06:24 -04:00
Slava Pestov
2f727d6b47 RequirementMachine: Opaque archetype support (sort of)
Complete support is behind a flag, because it can result in a non-convergent
rewrite system if the opaque result type has a recursive conformance of its
own (eg, `some View` for SwiftUI's View protocol).

Without the flag, it's good enough for simple examples; you just can't have
a requirement that mentions a nested type of a type parameter equated to
the concrete type.

Fixes rdar://problem/88135291, https://bugs.swift.org/browse/SR-15983.
2022-03-17 17:45:59 -04:00
Robert Widmann
363954a416 Put Variadic Generics Behind a Flag 2022-03-16 14:22:03 -07:00
Evan Wilde
c34f7055f8 Detach enable-experimental-async-top-level flag
SE-0343 is approved so it's time to pull the feature out from behind the
experimental feature flag. This patch pulls it out and deprecates
passing the flag to the frontend so that we can pull it out entirely
eventually.
2022-03-15 16:07:03 -07:00
Pavel Yaskevich
5331e276d5 Merge pull request #41730 from xedin/se-0326-solve-pattern-bindings-via-conjunctions
[SE-0326] Re-enable multi-statement closure inference by default
2022-03-15 13:21:03 -07:00
Konrad `ktoso` Malawski
13cc8b3157 [Distributed] Enable no-longer-experimental distributed by default 2022-03-11 22:14:49 +09:00
Andrew Trick
8a7e955b0d Move -enable-sil-opaque-value to SILOptions. 2022-03-09 17:18:15 -08:00
Pavel Yaskevich
5e4c964c36 [TypeChecker] SE-0326: Enable multi-statement closure inference by default 2022-03-08 21:37:40 -08:00
Slava Pestov
95f122f105 RequirementMachine: Add -enable-requirement-machine-loop-normalization flag 2022-03-08 22:47:22 -05:00
Becca Royal-Gordon
bbcd980aff Add flag for minimum inlining version 2022-03-04 10:54:52 -08:00
Slava Pestov
e8d240699e RequirementMachine: Add fourth 'check' option to 'on'/'off'/'verify' flags
This compares the results like 'verify' and prints output if there is
a mismatch, but does not assert.
2022-02-26 23:04:29 -05:00
Slava Pestov
8e09ba8b45 RequirementMachine: Introduce 'concrete contraction' pre-processing pass before building rewrite system
See the comment at the top of ConcreteContraction.cpp for a detailed explanation.

This can be turned off with the -disable-requirement-machine-concrete-contraction
pass, mostly meant for testing. A few tests now run with this pass both enabled
and disabled, to exercise code paths which are otherwise trivially avoided by
concrete contraction.

Fixes rdar://problem/88135912.
2022-02-25 11:48:38 -05:00
Pavel Yaskevich
cd61b35e37 [Frontend] Add a flag for experimental type inference from default expressions 2022-02-21 09:59:05 -08:00
Anthony Latsis
b0043966cd Merge pull request #40269 from AnthonyLatsis/assoc-inference-system
AssociatedTypeInference: Initial refactoring of abstract type witness inference
2022-02-20 15:51:58 +03:00
Doug Gregor
1e1b3427c3 Experimental support for implicitly opening existential arguments.
When calling a generic function with an argument of existential type,
implicitly "open" the existential type into a concrete archetype, which
can then be bound to the generic type. This extends the implicit
opening that is performed when accessing a member of an existential
type from the "self" parameter to all parameters. For example:

    func unsafeFirst<C: Collection>(_ c: C) -> C.Element { c.first! }

    func g(c: any Collection) {
      unsafeFirst(c)   // currently an error
                       // with this change, succeeds and produces an 'Any'
    }

This avoids many common sources of errors of the form

    protocol 'P' as a type cannot conform to the protocol itself

which come from calling generic functions with an existential, and
allows another way "out" if one has an existention and needs to treat
it generically.

This feature is behind a frontend flag
`-enable-experimental-opened-existential-types`.
2022-02-18 11:22:56 -08:00
Holly Borla
c2594d1338 [FrontendOptions] Remove the -enable-explicit-existential-types flag. 2022-02-17 17:54:59 -08:00
Doug Gregor
27056a0ed7 Enable SE-0341 "Opaque Parameter Declarations" by default.
This proposal has been accepted, so enable it by default and update
some diagnostics to stop implying that this feature cannot be used.
2022-02-17 13:57:45 -08:00
Anthony Latsis
ceb123b5e9 AssociatedTypeInference: Add -dump-type-witness-systems flag to enable debug output 2022-02-16 00:56:08 +03:00
Slava Pestov
e2e088e082 RequirementMachine: Remove merged associated types from completion 2022-02-07 18:57:45 -05:00
Slava Pestov
0060592b85 RequirementMachine: Add concrete nesting depth check
Configured with -requirement-machine-max-concrete-nesting= frontend flag.
2022-02-07 08:20:59 -05:00
Slava Pestov
634ca55764 RequirementMachine: Rework completion limits a bit
- Rename StepLimit to MaxRuleCount, DepthLimit to MaxRuleLength
- Rename command line flags to -requirement-machine-max-rule-{count,length}=
- Check limits outside of PropertyMap::buildPropertyMap()
- Simplify the logic in RequirementMachine::computeCompletion()
2022-02-07 08:20:59 -05:00
Nuri Amari
fda0b8053d Merge pull request #40903 from NuriAmari/default-diagnostics
Enable lazy ClangImporter diagnostics by default
2022-02-04 11:42:47 -05:00
Slava Pestov
aa67c8bf8a Parametrized => parameterized 2022-02-03 13:27:24 -05:00
Robert Widmann
25ab410896 Implement (Sugared) Bound Generic Extensions
A scoped-down version of #39307. Implement extension of bound generic types. The important bit here is in TypeCheckGeneric where we now use the underlying type of a typealias and its associated nominal type decl when we're generating substitutions for the extended type.

Put this behind a new experimental flag

-enable-experimental-bound-generic-extensions

Resolves SR-4875
Resolves rdar://17434633
2022-02-02 17:05:23 -08:00