Commit Graph

22218 Commits

Author SHA1 Message Date
Anthony Latsis
5c190b9613 AST: Cut down on DescriptiveDeclKind usage in DiagnosticsSIL.def 2025-04-05 12:31:20 +01:00
Anthony Latsis
3c3dd54f39 AST: Cut down on DescriptiveDeclKind usage in DiagnosticsParse.def 2025-04-05 12:31:20 +01:00
Anthony Latsis
2d899d0e73 AST: Cut down on DescriptiveDeclKind usage in DiagnosticsCommon.def 2025-04-05 12:31:20 +01:00
Anthony Latsis
cdb2aaccfd AST: Cut down on DescriptiveDeclKind usage in DiagnosticsClangImporter.def 2025-04-05 12:31:20 +01:00
Anthony Latsis
a0930dec31 AST: Cut down on DescriptiveDeclKind usage in DiagnosticsSema.def 2025-04-05 12:31:19 +01:00
Anthony Latsis
08d46d2542 Merge pull request #80473 from AnthonyLatsis/diag_type_attr
DiagnosticEngine: Support `TypeAttribute` diagnostic arguments
2025-04-05 12:25:45 +01:00
Hamish Knight
ccdff3259c Merge pull request #80546 from hamishknight/mangle-less
[Mangler] Avoid mangling local discriminator for attached macros
2025-04-05 10:14:49 +01:00
Hamish Knight
da1d37de26 [Mangler] Avoid mangling local discriminator for attached macros
If we're using the macro-specific local discriminator, we need to
make sure we avoid mangling the regular local discriminator in
`appendDeclName`, since that could prematurely kick local discriminator
assignment before type-checking has finished.

rdar://143834482
2025-04-04 19:41:04 +01:00
Artem Chikin
6eaa07a880 Merge pull request #80540 from swiftlang/revert-80452-lifetimeinout
Revert "Add support for inout lifetime dependence"
2025-04-04 09:31:46 -07:00
Joe Groff
b4fb5296f9 Merge pull request #80519 from jckarter/canonicalize-integer-generic-parameters
Canonicalize different spellings of the same integer generic parameter.
2025-04-04 09:25:18 -07:00
Pavel Yaskevich
8bf8c24bf9 Merge pull request #80503 from xedin/extensible-attr
[AST/Sema] Add `@extensible` attribute on `enum` declarations
2025-04-04 09:17:56 -07:00
Artem Chikin
39e1791b67 Revert "Add support for inout lifetime dependence" 2025-04-04 09:00:09 -07:00
Slava Pestov
9148ae32bd Merge pull request #80482 from slavapestov/abstract-conformance-cleanup
AST: Simplify ProtocolConformanceRef operations a little bit
2025-04-04 10:37:49 -04:00
Meghana Gupta
50ea777936 Merge pull request #80452 from meg-gupta/lifetimeinout
Add support for inout lifetime dependence
2025-04-04 02:04:53 -07:00
Joe Groff
5a09c0b4e0 Canonicalize different spellings of the same integer generic parameter.
`Foo<256>`, `Foo<2_56>`, and `Foo<0x100>` are all canonically the same type.
Fixes rdar://144736386.
2025-04-03 18:56:00 -07:00
Meghana Gupta
0d3d89ae22 [NFC] Update diagnostic msg 2025-04-03 17:22:13 -07:00
Meghana Gupta
d87a2b2ada Rename ParsedLifetimeDependenceKind::Scope -> ParsedLifetimeDependenceKind::Borrow 2025-04-03 17:22:13 -07:00
Meghana Gupta
cfacd25df4 Add support for @lifetime(&arg) 2025-04-03 17:22:06 -07:00
Pavel Yaskevich
bf19481ab6 [Frontend/Serialization] Remove ExtensibleEnums experimental flag
For now the semantics provided by `@extensible` keyword on per-enum
basis. We might return this as an upcoming feature in the future with
a way to opt-out.
2025-04-03 16:30:23 -07:00
Pavel Yaskevich
a0ae93d3a8 [AST/Sema] Add @extensible attribute on enum declarations
This attribute controls whether cross-module access to the declaration
needs `@unknown default:` because it's allowed to gain new cases even
if the module is non-resilient.
2025-04-03 16:30:19 -07:00
Augusto Noronha
cac0abbfde Merge pull request #80380 from augusto2112/fix-opaque
[DebugInfo] Use underlying type of global variables with opaque type
2025-04-03 15:39:11 -07:00
Slava Pestov
e475b08011 AST: Remove AssociatedType 2025-04-03 17:35:35 -04:00
Slava Pestov
cea72e35a9 AST: Remove ProtocolConformanceRef::getAssociatedType() 2025-04-03 17:35:34 -04:00
Slava Pestov
a06a4213ef AST: Remove origType parameter from substOpaqueTypesWithUnderlyingTypes() 2025-04-03 17:35:34 -04:00
Slava Pestov
ea05708716 AST: Eliminate GenericEnvironment::mapConformanceRefIntoContext() 2025-04-03 17:35:34 -04:00
Slava Pestov
ec0dfc8716 AST: Add new form of SubstitutionMap::getProtocolSubstitutions() 2025-04-03 17:35:33 -04:00
Slava Pestov
0616333129 AST: Remove origType parameter from ProtocolConformanceRef::getAssociatedType() 2025-04-03 17:35:33 -04:00
Slava Pestov
a209ff8869 AST: Remove origType parameter from ProtocolConformanceRef::subst() 2025-04-03 17:35:33 -04:00
Slava Pestov
7399eeb602 AST: Remove type parameter from ProtocolConformanceRef::getWitnessByName() 2025-04-03 17:35:33 -04:00
Slava Pestov
00766f7deb AST: Remove type parameter from ProtocolConformanceRef::getTypeWitnessByName() 2025-04-03 17:35:32 -04:00
Slava Pestov
91503710bc AST: Remove origType parameter from ProtocolConformanceRef::getTypeWitness() 2025-04-03 17:35:32 -04:00
Slava Pestov
8b1514cfd7 AST: Remove origType parameter from ProtocolConformanceRef::getAssociatedConformance() 2025-04-03 17:35:32 -04:00
Hamish Knight
918d4b54cf Merge pull request #80461 from hamishknight/in-sequence
[ASTScope] Allow `try` in unfolded sequence to cover following elements
2025-04-03 20:23:51 +01:00
Doug Gregor
daf8d97616 Merge pull request #80484 from DougGregor/isolated-conformances-fix-and-docs
[SE-0470] Ensure that one cannot form an isolated conformance when Self: Sendable
2025-04-02 23:00:47 -07:00
Doug Gregor
1c5372858b [SE-0470] Ensure that one cannot form an isolated conformance when Self: Sendable
While here, fix some issues around implied isolated conformances (we
could get into an inconsistent state). Also provide an educational
note discussing isolated conformances and the kinds of errors one can
see when they are used from outside of their isolation domain.
2025-04-02 18:19:09 -07:00
Anthony Latsis
99f63ed933 DiagnosticEngine: Support TypeAttribute diagnostic arguments 2025-04-03 01:52:38 +01:00
Allan Shortlidge
5cd5f31c9c Sema: Fix a regression in -require-explicit-availability diagnostics.
The changes in https://github.com/swiftlang/swift/pull/80040 caused the
compiler to start diagnosing extensions containing only members that are
either `@_spi`, `@_alwaysEmitIntoClient`, or unavailable when the
`-require-explicit-availability` flag is passed. Extensions should not be
diagnosed when they only contain members that would not be diagnosed
themselves.

Resolves rdar://148275432.
2025-04-02 17:12:38 -07:00
Joe Groff
562d7dc832 Merge pull request #80438 from jckarter/substitute-away-escapable-lifetime-deps
Type substitution eliminates dependencies with Escapable targets.
2025-04-02 16:56:54 -07:00
Anthony Latsis
dafad5b33c [NFC] Factor out DiagnosticArgument into a new file 2025-04-03 00:50:27 +01:00
Artem Chikin
2e31e4692f Merge pull request #80414 from artemcm/RestorePriorCanImportBehaviour
[Explicit Module Builds] Switch versioned `canImport` to return `true` when encountering unversioned candidate
2025-04-02 09:02:56 -07:00
Joe Groff
6b605f41cb Type substitution eliminates dependencies with Escapable targets.
When a generic function has potentially Escapable outputs, those outputs
declare lifetime dependencies, which have no effect when substitution
leads to those types becoming `Escapable` in a concrete context.
This means that type substitution should canonically eliminate lifetime
dependencies targeting Escapable parameters or returns, and that
type checking should allow a function value with potentially-Escapable
lifetime dependencies to bind to a function type without those dependencies
when the target of the dependencies is Escapable.

Fixes rdar://147533059.
2025-04-02 08:54:45 -07:00
Slava Pestov
03d8fd7ceb Merge pull request #80445 from slavapestov/fix-issue-80288
Sema: Fix handling of getter typed throws in witness matching
2025-04-02 08:01:10 -04:00
Hamish Knight
2e1c37f1ab [ASTScope] Allow try in unfolded sequence to cover following elements
Rather than fixing-up in the parser, adjust the ASTScope logic such
that a `try` element in a SequenceExpr is considered as covering all
elements to the right of it. Cases where this isn't true are invalid,
and will be diagnosed during sequence folding. e.g:

```
0 * try foo() + bar()
_ = try foo() ~~~ bar() // Assuming `~~~` has lower precedence than `=`
```

This ensures we correctly handle `try` in assignment sequences, and
allows ASTGen to get the behavior for free.

rdar://132872235
2025-04-02 12:46:21 +01:00
Hamish Knight
d958c0e080 [AST] Introduce Expr::isAlwaysLeftFolded
Use this to query for `try`-like expressions when it comes to binary
operator folding.
2025-04-02 12:29:45 +01:00
eeckstein
6c0b7782f5 Merge pull request #80404 from eeckstein/optimize-floating-point
Optimizer: add some floating point optimizations
2025-04-02 13:06:25 +02:00
Anthony Latsis
d14a85e380 Merge pull request #80458 from AnthonyLatsis/hildoceras
DiagnosticEngine: Always favor the category of a wrapped diagnostic
2025-04-02 11:26:28 +01:00
Pavel Yaskevich
bf2d01e562 Merge pull request #80419 from xedin/revert-pr-79397
Revert "Sema: Allow optional-to-optional CGFloat <-> Double conversion"
2025-04-02 00:10:23 -07:00
Anthony Latsis
148c1773a5 DiagnosticEngine: Always favor the category of a wrapped diagnostic 2025-04-02 06:45:15 +01:00
Artem Chikin
c9ba79c8da [Dependency Scanning] Always record best version of discovered 'canImport'-ed modules
Suppose module 'Foo' exists in the search paths and specifies user module version '1.0'.

If the first encountered 'canImport' query is unversioned:
...

Followed by a versioned one:
...

The success of the first check will record an unversioned successful canImport, which will cause the second check to evaluate to 'true', which is incorrect.

This change causes even unversioned 'canImport' checks to track and record the discovered user module version.
2025-04-01 14:55:37 -07:00
Slava Pestov
d5937e6ac0 IRGen: Verify round-tripping of debug info types when conditional asserts are enabled
Move this away from the compile-time NDEBUG flag.
2025-04-01 14:53:49 -04:00