Commit Graph

1534 Commits

Author SHA1 Message Date
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
Doug Gregor
b9f31a8547 Remove SwiftOnoneSupport hack for implicit opening of existentials 2022-03-24 13:08:00 -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
Allan Shortlidge
4e99cca356 Merge pull request #41940 from tshortli/target-min-inlining-version-min-by-default
Assume `-target-min-inlining-version min` for `-library-level api` modules
2022-03-22 15:26:02 -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
Allan Shortlidge
81fc0aed87 Frontend: By default, assume -target-min-inlining-version min for modules compiled with -library-level api to catch availability issues in API swiftinterfaces.
Resolves rdar://90575987
2022-03-21 15:02:40 -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
058190e2b9 Enable -requirement-machine-inferred-signatures=verify by default 2022-03-18 00:43:26 -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
Allan Shortlidge
b563dc0736 Frontend: Replace the abi magic value accepted by -target-min-inlining-version with a min magic value instead. The new value corresponds to the OS versions in which Swift was introduced. The introduction OS is a better floor for availability checking than the OS in which Swift became ABI stable because inlinable functions may reference clang declarations which have availability between Swift's introduction and ABI stability and framework developers ought to get diagnostics for unguarded use of those APIs in inlinable code. 2022-03-14 19:26:36 -07:00
Andrew Trick
8a7e955b0d Move -enable-sil-opaque-value to SILOptions. 2022-03-09 17:18:15 -08:00
Slava Pestov
95f122f105 RequirementMachine: Add -enable-requirement-machine-loop-normalization flag 2022-03-08 22:47:22 -05:00
Slava Pestov
a0b71e9a68 Enable -requirement-machine-abstract-signatures=verify by default 2022-03-07 23:20:41 -05:00
Allan Shortlidge
e25b822f7a Merge pull request #41673 from tshortli/inlining-availability-checking
Add -target-min-inlining-version to aid type checking for inlinable functions in resilient libraries
2022-03-07 17:30:59 -08:00
Becca Royal-Gordon
bbcd980aff Add flag for minimum inlining version 2022-03-04 10:54:52 -08:00
Andrew Trick
ab31239ace Add a comment about lexical lifetimes to CompilerInvocation.
Otherwise, it's hard for me to tell who's in charge of setting the
default.
2022-03-03 15:08:26 -08:00
Erik Eckstein
1dfb3b1a2a cross-module-optimization: be more conservative when emitting a TBD file.
If we are emitting a TBD file, the TBD file only contains public symbols of this module.
But not public symbols of imported modules which are statically linked to the current binary.
This prevents referencing public symbols from other modules which could (potentially) linked statically.
Unfortunately there is no way to find out if another module is linked statically or dynamically, so we have to be conservative.

Fixes an unresolved-symbol linker error.
rdar://89364148
2022-03-03 11:42:07 +01: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
Slava Pestov
48a882899b Merge pull request #40492 from slavapestov/rqm-enable-protocol-verify
RequirementMachine: Enable -requirement-machine-protocol-signatures=verify by default
2022-02-25 10:45:10 -05:00
Xi Ge
1115332ab9 ModuleInterface: add a frontend flag to skip printing import statement corresponding to a module name.
Related: rdar://63465931
2022-02-24 15:33:26 -08:00
Slava Pestov
0e600d1384 RequirementMachine: Enable -requirement-machine-protocol-signatures=verify by default 2022-02-24 14:26:08 -05:00
Pavel Yaskevich
8cfdb9999c Merge pull request #41436 from xedin/allow-specialization-from-default-expr
[TypeChecker] Allow inference from default expressions in certain scenarios (under a flag)
2022-02-24 08:57:42 -08:00
Karoy Lorentey
e24bb55abf Merge pull request #41449 from lorentey/custom-traps
[IRGen] Allow configuring a panic function to call instead of trapping
2022-02-21 12:46:33 -08:00
Pavel Yaskevich
cd61b35e37 [Frontend] Add a flag for experimental type inference from default expressions 2022-02-21 09:59:05 -08:00
Saleem Abdulrasool
d526dcf309 Merge pull request #41431 from compnerd/externally-consumed-internally
IRGen: internalize symbols with `-static`
2022-02-21 09:12:11 -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
Saleem Abdulrasool
98bd2dba57 IRGen: internalize symbols with -static
This pipes the `-static` flag when building a static library into IRGen.
This should have no impact on non-Windows targets as the usage of the
information simply removes the `dllexport` attribute on the generated
interfaces.  This ensures that a library built with `-static` will not
re-export its interfaces from the consumer.  This is important to ensure
that the consumer does not vend the API surface when it statically links
a library.  In conjunction with the removal of the force load symbol,
this allows the generation of static libraries which may be linked
against on Windows.  However, a subsequent change is needed to ensure
that the consumer does not mark the symbol as being imported from a
foreign module (i.e. `dllimport`).
2022-02-18 19:42:08 +00:00
Doug Gregor
0215216c00 Add "disable" counterpart to -enable-experimental-opened-existential-types 2022-02-18 11:22:57 -08:00
Doug Gregor
196a4d2e4b SwiftOnoneSupport creates different specializations with opened existentials
Implicitly disable implicit opening of existentials for SwiftOnoneSupport
because it generates different specializations.
2022-02-18 11:22:57 -08: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
Karoy Lorentey
2966dce3d9 [IRGen] Allow configuring a panic function to call instead of trapping
Add a new frontend option (called `-trap-function <name>`, similar to Clang’s existing `-ftrap-function`) that specifies a function to call instead of trapping.

When the option is used, the compiler will emit a call to the specified function every time it would have otherwise emitted a trap instruction. The function must have no parameters and it must never return.

rdar://89125883
2022-02-17 23:19:08 -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
f5b4092a32 Merge pull request #41172 from CodaFi/special-sauce 2022-02-03 09:19:07 -08:00
Kuba (Brecka) Mracek
ee7e04822c Add a -reflection-metadata-for-debugger-only flag that emits reflection metadata but does not link them from runtime data structures (#40853) 2022-02-03 05:53:31 -08: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
Kuba (Brecka) Mracek
17c5d6f0de Add a flag to disable compile-time preallocated instantiation caches (for type metadata and protocol conformances) (#41148) 2022-02-02 12:06:16 -08:00
Nuri Amari
7ec861fbd9 Enable lazy ClangImporter diagnostics by default
Replace the existing `-enable-experimental-clang-importer-diagnostics`
flag with an opt-out version entitled `-disable-experimentalc-clang-importer-diagnostics`.
Enable the beviour previously hidden behind the old flag by default.
2022-02-01 18:43:49 -05:00