Allan Shortlidge
1a600f4a79
Merge pull request #42351 from tshortli/adopt-interface-verification-in-more-tests
...
ModuleInterface: Enable interface verification in more tests
2022-04-18 09:12:03 -07:00
Allan Shortlidge
747f286b8d
ModuleInterface: Adopt new swiftinterface verification lit substitutions pervasively in tests where they can be adopted by simply updating or adding a few RUN: lines.
2022-04-15 20:13:00 -07:00
Allan Shortlidge
922af42afd
ModuleInterface: Adopt swiftinterface verification lit substitutions in synthesized.swift. Update the test to expect output for a resilient framework by removing @inlinable attributes from a few decls.
2022-04-15 20:12:59 -07:00
Allan Shortlidge
fa94c20abb
ModuleInterface: Adopt swiftinterface verification lit substitutions in preserve-type-repr.swift. The test was originally written assuming that CHECK: lines are always matched by FileCheck even when alternate prefixes are specified via --check-prefix, so it contained some incorrect expectations that needed to be updated.
2022-04-15 20:12:59 -07:00
Allan Shortlidge
f40f0b029b
ModuleInterface: Adopt swiftinterface verification lit substitutions in access-filter.swift. Fix an error caused by conforming to a @usableFromInline protocol using a non-UFI member (this was diagnosed as a warning in Swift 4 and became an error in Swift 5). Also, remove @_hasInitialValue from the expted swiftinterface contents since that attribute isn't emitted for types in resilient modules.
2022-04-15 20:12:59 -07:00
Allan Shortlidge
e10ebcab08
ModuleInterface: Adopt swiftinterface verification lit substitutions in emit-interface-macos-canonical-version.swift. Move the test to the ModuleInterface directory to colocate it with other swiftinterface generation tests and rename it to availability-macos-canonical-version.swift. Remove an extraneous -experimental-skip-non-inlinable-function-bodies flag that seemed like it was copypasta.
2022-04-15 20:12:59 -07:00
Allan Shortlidge
aeafcf8b0f
ModuleInterface: Adopt swiftinterface verification lit substitutions in available-attr-no-collapse.swift. Also, put the input file contents directly in the test file instead of RUN: echo lines to make the test a bit easier to understand.
2022-04-15 20:12:59 -07:00
Allan Shortlidge
ab9bff389b
ModuleInterface: Adopt swiftinterface verification lit substitutions in escape-Type-and-Protocol.swift. Update the test to no longer expect @_hasInitialValue to be emitted since that attribute is intentionally dropped from interfaces when -enable-library-evolution is specified.
2022-04-15 20:12:59 -07:00
Allan Shortlidge
bdd08ac654
ModuleInterface: Adopt swiftinterface verification lit substitutions in inherited-generic-parameters.swift. This revealed that function decls without explicit parameter names can be printed into swiftinterfaces with duplicate synthesized names so update the test to avoid that bug.
2022-04-15 20:12:59 -07:00
Allan Shortlidge
83ed2dc5d1
ModuleInterface: Adopt swiftinterface verification lit substitutions in skip-override-keyword.swift and skip-override-spi.swift. Add CHECK lines to these tests to make their expectations a bit more explicit.
2022-04-15 20:12:59 -07:00
Allan Shortlidge
454689a399
ModuleInterface: Adopt swiftinterface verification lit substitutions in back-deploy-attr.swift. Simplify the test now that another test exercises deserialization of the attribute from a module.
2022-04-15 15:50:59 -07:00
Doug Gregor
9de1a79511
Merge pull request #42362 from DougGregor/preconcurrency-silence-swiftinterface
2022-04-14 21:14:00 -07:00
Doug Gregor
aad67a828b
Only run this new test on macOS
2022-04-14 17:25:48 -07:00
Allan Shortlidge
d3dbe75419
ModuleInterface: Introduce the %target-swift-emit-module-interface and %target-swift-typecheck-module-from-interface lit substitutions and adopt them in some tests that involve emitting a swiftinterface. The substitutions specify the additional flags -swift-version 5 -enable-library-evolution. There are a few motivations for adding these substitutions:
...
- Tests that depend on emitted interfaces should generally use flags that are typical for modules that have textual interfaces (e.g. `-enable-library-evolution`).
- If a test is intended to produce a valid `swiftinterface` then it should verify that interface. This will help prevent interface printing regressions caused by compiler changes.
- Having commonly used substitutions for tests that emit interfaces makes it easy to experiment with compiler flags that might effect interface printing.
Resolves rdar://91634358
2022-04-14 15:09:36 -07:00
Allan Shortlidge
cc0627a8cb
Merge pull request #42276 from tshortli/global-actor-broken-swift-interface
...
ModuleInterface: Wrap synthesized extensions in swiftinterfaces with feature guards
2022-04-14 15:08:11 -07:00
Doug Gregor
8cef6d5572
Don't emit @preconcurrency import warnings for Swift interfaces
...
Fixes rdar://88758592.
2022-04-13 23:19:50 -07:00
Daniel Duan
3dfc40898c
[NFC] Remove Python 2 imports from __future__ ( #42086 )
...
The `__future__` we relied on is now, where the 3 specific things are
all included [since Python 3.0](https://docs.python.org/3/library/__future__.html ):
* absolute_import
* print_function
* unicode_literals
* division
These import statements are no-ops and are no longer necessary.
2022-04-13 14:01:30 -07:00
Allan Shortlidge
f27005b8d0
ModuleInterface: When printing synthesized extensions, we need to be sure to guard them with required features if applicable. Not doing so can result in broken interfaces that do not typecheck because, for instance, a conformance can refer to a nominal type that is only declared when certain features are enabled.
...
Also, fix a typo where `#elsif` was printed into interfaces instead of `#elseif`.
Resolves rdar://91509673
2022-04-12 17:53:59 -07:00
Artem Chikin
b3726d097b
Merge pull request #42217 from artemcm/BareBonesRegexSyntax
...
Rename flag for enabling forward slash literals to be less ambiguous.
2022-04-11 16:40:23 -07:00
Slava Pestov
9a7df88bc8
ASTPrinter: Rename PrimaryAssociatedTypes feature to PrimaryAssociatedTypes2
...
There was a window where the PrimaryAssociatedTypes feature guarded the old
syntax; let's make sure we don't see breakage if a new standard library is
used with an old compiler.
2022-04-11 15:27:38 -04:00
Slava Pestov
b16498c3df
ASTPrinter: Remove printWithCompatibilityFeatureChecks() from printSynthesizedExtensionIfNeeded()
...
This path was not exercised in the test suite, and when the
PrimaryAssociatedTypes feature finally (incorrectly) triggered it,
it would print '#endifextension'.
2022-04-06 23:47:10 -04: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
Artem Chikin
7ba377b3c2
Rename flag for enabling forward slash literals to be less ambiguous.
...
Previous spelling could easily be mistaken for gating the entire feature.
Part of rdar://91119995
2022-04-06 09:46:40 -07:00
Xi Ge
6b1f736f16
Availability: only diagnose exposing SPI_AVAILABLE symbols in modules with library-level=API
...
For executable targets or private libraries, using SPI_AVAILABLE symbols should be allowed.
rdar://91088241
2022-04-04 15:33:30 -07:00
Slava Pestov
07e53c2b0f
Merge pull request #42158 from slavapestov/se-0346-revisions
...
Revise SE-0346 implementation for core team decision
2022-04-04 02:01:40 -04:00
Slava Pestov
8c47cd75fd
Sema: The primary associated type list references existing associated types instead of declaring new ones
2022-04-03 22:03:49 -04:00
Xi Ge
8dd638fbd0
ModuleInterface: ensure -disable-clang-spi flag to propagate to module interface builders
2022-04-02 21:31:00 -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
Doug Gregor
5e50ee8560
Add @available attributes on the implicit "extension" for @_nonSendable types
...
`@_nonSendable` on a type effectively desugars to an unavailable
extension that provides (`@unchecked`) conformance to the `Sendable`
protocol. Make sure we copy over platform availability so that the
extension does not promise greater availability than the type it extends.
Fixes rdar://90330588.
2022-03-25 11:01:44 -07:00
Evan Wilde
aa51bdf17a
Add noasync availability kind to available attr
...
This patch adds the `noasync` availability kind to `@available`. The
spelling is `@available(*, noasync)`.
2022-03-22 15:12:51 -07:00
Allan Shortlidge
59b62c2cc9
NFC: Update tests to include "before: " label in the @_backDeploy attribute.
2022-03-18 11:24:47 -07:00
Slava Pestov
305a1e42b6
RequirementMachine: Update some tests to pass with -requirement-machine-inferred-signatures=verify
2022-03-14 12:33:18 -04:00
Allan Shortlidge
c1e326cbb0
SILGen: Fix SILGen for accessor functions with @_backDeploy. Previously, the @_backDeploy attribute was ignored when generating SIL for accessors on declarations with the attribute since the accessor decls themselves were not directly annotated.
...
Also, emit an error when `@_backDeploy` is applied to coroutine accessors since they are not supported yet.
Resolves rdar://90112441
2022-03-11 11:07:04 -08:00
Doug Gregor
323238fc79
Merge pull request #41760 from DougGregor/print-sendable-typereprs
2022-03-10 12:56:21 -08:00
Doug Gregor
a6b586ded7
Ensure that we print @Sendable when printing TypeReprs.
...
Fixes rdar://85453819.
2022-03-09 17:51:36 -08:00
Allan Shortlidge
b29251219a
Parse: Add availability macro support to @_backDeploy attribute parsing. Consolidate parsing code shared between @_originallyDefinedIn and @_backDeploy.
2022-03-08 14:13:10 -08: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
Xi Ge
610a4a5e41
Merge pull request #41692 from nkcsgexi/spi-available
2022-03-06 12:40:20 -08:00
Xi Ge
1395af1c9c
test: more module interface tests
2022-03-05 12:00:39 -08:00
Xi Ge
c8ada279d0
test: add a module interface test
2022-03-05 11:25:10 -08:00
Evan Wilde
822097353b
Check unavailable from async in interface file
...
We need to check the feature availability of _unavailableFromAsync
before it gets picked up in the swift interface file. This updates the
compiler to provide the necessary wrappings for that check.
2022-03-04 15:16:03 -08:00
Becca Royal-Gordon
bbcd980aff
Add flag for minimum inlining version
2022-03-04 10:54:52 -08:00
Slava Pestov
20ccd05120
AST: Support new primary associated type syntax in the ASTPrinter
2022-03-03 10:15:12 -05:00
Allan Shortlidge
e39c55023f
AST: Add support for @_backDeploy on computed properties, subscripts, and accessors.
2022-03-01 13:29:09 -08:00
Allan Shortlidge
da2ae43b4f
Sema: Diagnose invalid back deployed declarations. Back deployed declarations must:
...
- have public visibility
- have at most one back deployment version per-platform
- specify an introduced version for each platform with a back deployment version using @available
- have a back deployment version that is greater than the introduced version
- not have conflicting attributes like @_alwaysEmitIntoClient
Refactor to share code with type checking for @_originallyDefinedIn which has overlapping diagnostics.
2022-02-28 16:00:28 -08:00
Allan Shortlidge
20b454a037
NFC: Flip the OS versions for the @available attribute and the @_backDeploy attribute. Declarations should be marked available starting in the first OS they can be back deployed to and the @_backDeploy attribute should indicate which OS version the declaration first became ABI in.
2022-02-25 17:51:12 -08:00
Allan Shortlidge
9e4ba442a2
Merge pull request #41416 from tshortli/back-deploy-thunk
...
Emit and call thunks for back deployed functions
2022-02-25 17:49:08 -08: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
Victoria Mitchell
cab1669e09
only recurse getDisplayDecls in SymbolGraphGen
2022-02-19 10:32:29 -07:00
Allan Shortlidge
123f953e31
NFC: Remove out of date FIXME in back-deploy-attr.swift test.
2022-02-18 16:30:27 -08:00