Commit Graph

23610 Commits

Author SHA1 Message Date
Hamish Knight
017794a7d7 Merge pull request #65098 from hamishknight/poundland 2023-04-21 09:26:10 +01:00
Alex Lorenz
71ef7e8d3d [interop][SwiftToCxx] do not expose unsupported enums yet
This includes indirect enums, enums with multiple associated values, or enums whose associated value is a type we don't yet support
2023-04-20 18:05:00 -07:00
Anthony Latsis
d224efc8a8 Merge pull request #65318 from AnthonyLatsis/revert-f608802cfe498b8684e4ea63603fe99073102ce6
Revert "Sema: Emit diagnostics when walking into collection literals with defaulted types"
2023-04-21 01:26:03 +03:00
Cal Stephens
ee906f7ba5 Merge branch 'main' into cal--SE-3065-bad-pattern-check 2023-04-20 13:41:48 -07:00
Cal Stephens
870dbccf88 Consolidate LabeledConditionalStmt::rebindsSelf logic into shared helper 2023-04-20 13:39:05 -07:00
Anthony Latsis
f76f6acbf0 Revert "Sema: Emit diagnostics when walking into collection literals with defaulted types"
This reverts commit f608802cfe.
2023-04-20 21:55:40 +03:00
Cal Stephens
3e140286e8 Fix issue where non-pattern-binding condition would break SE-0365 unwrapped self check 2023-04-19 19:17:35 -07:00
Rintaro Ishizaki
8dcca5809f Merge pull request #65263 from rintaro/nullterminatedstringref-rdar108215490
[Basic] Ensure empty NullTerminatedStringRef have valid pointer
2023-04-19 15:22:47 -07:00
Slava Pestov
f1b8d9d111 Merge pull request #65278 from slavapestov/astprinter-pack-requirement
ASTPrinter: Fix printing of pack requirements
2023-04-19 16:14:40 -04:00
Angela Laar
a473281b43 Merge pull request #64520 from angela-laar/duplicate-raw-value-crash
[Sema] Compiler should diagnose non-unique raw values without crashing
2023-04-19 12:34:47 -07:00
Rintaro Ishizaki
a0eb32e4d7 [Macros] Create llvm::MemoryBuffer directly from macro expansion result
Saves one memory copy. No need to create a temporary
NullTerminatedStringRef.
2023-04-19 10:50:56 -07:00
Slava Pestov
df5d531dc6 ASTPrinter: Fix printing of pack requirements
Also remove the flag for printing 'each' and make it always on.
2023-04-19 13:04:51 -04:00
Artem Chikin
a5017db87a Merge pull request #65234 from artemcm/TestableDependencyOptionalLookup
[Dependency Scanning] Consider optional dependencies of `@testable` textual dependencies with an adjacent binary module
2023-04-19 08:41:45 -07:00
Anthony Latsis
0028322485 Merge pull request #65246 from AnthonyLatsis/nfc-debug-constraints
[NFC] CS: Misc minor debug output tweaks
2023-04-19 02:46:05 +03:00
Doug Gregor
8b76522038 Merge pull request #65253 from DougGregor/objc-impl-async-completion-handler-matching
Handle async vs. completion-handler mismatches in `@_objcImplementation`.
2023-04-18 13:01:11 -07:00
Anthony Latsis
82ac9328ae [NFC] CS: Misc minor debug output tweaks
* Use fancy arrows (`→`) because they are distinct from and shorter than `->`,
  and fancier.
* We have two ways of demarcating locators: `@ <locator>` and `[[<locator>]];`.
  Stick to the first, which is shorter and clearer.
* 'attempting type variable' → 'attempting binding'. *Bindings* are attempted,
  not type variables.
* `considering ->` → `considering:`. I think a colon is semantically more fit
  and makes things easier to read if the considered constraint has arrows in its
  description or types. It’s also shorter this way.
2023-04-18 22:42:59 +03:00
Doug Gregor
79e26970ba Handle async vs. completion-handler mismatches in @_objcImplementation.
Fixes rdar://108160837.
2023-04-18 08:52:20 -07:00
Artem Chikin
6fcd8be072 [Dependency Scanning] Pull optional dependencies from the adjacent binary module for direct interface dependencies
For a `@Testable` import in program source, if a Swift interface dependency is discovered, and has an adjacent binary `.swiftmodule`, open up the module, and pull in its optional dependencies. If an optional dependency cannot be resolved on the filesystem, fail silently without raising a diagnostic.
2023-04-17 14:47:46 -07:00
Joe Groff
8ea5ab84d3 Merge pull request #65173 from jckarter/noncopyable-tuples-not-supported
Diagnose attempts to use tuples with noncopyable elements.
2023-04-17 10:49:53 -07:00
Doug Gregor
9436899526 Merge pull request #65219 from DougGregor/reference-cycle-visible-name-lookup 2023-04-17 08:05:58 -04:00
Doug Gregor
ab682f1658 [Macros] Break reference cycles involving visible name lookup 2023-04-16 13:31:42 -04:00
Holly Borla
0ed4b3325f [SE-0393] Enable parameter packs for generic functions.
The VariadicGenerics flag still exists and is required for generic types
with parameter packs
2023-04-15 15:40:05 -07:00
Joe Groff
52e97d6544 Diagnose attempts to use tuples with noncopyable elements.
These aren't fully supported yet. rdar://108024586
2023-04-14 16:49:30 -07:00
Dave Lee
39bb7bfe44 [AST] Convert ASTContext::getSwiftName to a free function
The only state `getSwiftName` uses is its argument, and can be made a free function. Of
note the inverse operation, `getKnownFoundationEntity`, is also a free function. This
removes the requirement that callers have an `ASTContext` instance.

(cherry-picked from commit fb524c0b86)
2023-04-14 11:43:13 -06:00
Pavel Yaskevich
f13e1319d5 Merge pull request #65165 from xedin/record-pack-expansion-envs
[CSSolver] Add recorded pack expansion environments to solutions
2023-04-14 09:44:54 -07:00
Anthony Latsis
8f2f9d94af Merge pull request #65132 from AnthonyLatsis/fukamushicha
[NFC] ExistentialRequiresAnyRequest → HasSelfOrAssociatedTypeRequirementsRequest
2023-04-13 22:22:28 +03:00
Holly Borla
35fcc37136 Merge pull request #65134 from hborla/parameter-pack-revision
[SE-0393] Require the `repeat` keyword for generic requirement expansions.
2023-04-13 08:33:25 -07:00
Holly Borla
234b5dc660 [SE-0393] Require the repeat keyword for generic requirement expansions. 2023-04-12 22:04:01 -07:00
Anthony Latsis
39c9ae2fc6 [NFC] ExistentialRequiresAnyRequest → HasSelfOrAssociatedTypeRequirementsRequest
The current name is misleading because it suggests that the request accounts
for language feature state, which it does not (and is not supposed to).
2023-04-13 07:50:06 +03:00
Anthony Latsis
8d1d526195 TypeCheckType: Fix existential 'any' migration diagnostics for extra-modular protocols 2023-04-13 03:37:25 +03:00
Pavel Yaskevich
fdca26588e [CSSolver] Add recorded pack expansion environments to solutions
Fixes a bug where only pack environments created during constraint
would be usable during solution application, everything else would
create a new environment that would produce pack elements with new
UUIDs which cases issues during SILGen.
2023-04-12 14:14:15 -07:00
Ellie Shin
9680734250 Merge pull request #65109 from apple/es-fix
Add a target nil check
2023-04-12 13:59:51 -07:00
Pavel Yaskevich
6c9bd8d7a5 Merge pull request #65071 from xedin/rdar-107835060-followup
[CSSyntaticElement] Canonicalize type before collecting "in scope" va…
2023-04-12 12:21:19 -07:00
Ellie Shin
bb99eb08ac Add a target nil check
Resolves rdar://107837804
2023-04-12 11:16:19 -07:00
Doug Gregor
2bcef82eb5 Merge pull request #65032 from DougGregor/attached-macro-mangle-without-cycles 2023-04-12 12:58:35 -04:00
Hamish Knight
3f7c3a2faf Handle #if for if/switch expressions
- Allow an if/switch expression to become an
implicit return of a function that has a `#if`
body with a single active element that is an `if`
or `switch`.
- Allow `#if` branches of an if/switch expression,
as long as there is a single active expression
element.

rdar://107487977
2023-04-12 14:54:22 +01:00
Hamish Knight
bca451baa0 [Sema] Improve diagnostic for empty if expr branch
Previously we would say that it must end with a
`throw`, but a more useful diagnostic is that
there is an expression missing.
2023-04-12 14:54:22 +01:00
Doug Gregor
ef7970bad3 [Macros] Ensure that we compute the interface type before we add accessors
Adding accessors to a stored property, which removes its initializer.
Force computation of the interface type first.

There are better ways to model this in the AST, but it requires
reworking how we handle initializers to break them into requests.
2023-04-11 23:40:32 -04:00
Rintaro Ishizaki
ace080c9f3 [Macros] Make 'LoadedCompilerPlugin' a wrapper of PointerUnion 2023-04-11 14:59:23 -07:00
Rintaro Ishizaki
f99d70d181 [Macros] PluginRegistry vends 'LoadedLibraryPlugin' instead of 'void *'
`LoadedLibraryPlugin` is currently just a wrapper of `void` pointer from
`dlopen`. This will be convenient for abstracting platform specific
dynamic linrary handling.
2023-04-11 14:59:22 -07:00
Pavel Yaskevich
976c0b17c3 [CSSyntaticElement] Canonicalize type before collecting "in scope" variables
Follow-up to https://github.com/apple/swift/pull/65048

`getDesugaredType` unwraps sugar types that appear in sequence,
to remove sugar from nested positions we need to get a canonical type.

Thanks to @slavapestov for pointing it out.
2023-04-11 11:53:31 -07:00
Pavel Yaskevich
6b3a17bad9 Merge pull request #65048 from xedin/rdar-107835060
[CSSyntaticElement] Desugar types before collecting "in scope" type v…
2023-04-11 10:47:38 -07:00
Pavel Yaskevich
0bdacfb4eb Merge pull request #64786 from calda/cal--64757
[SE-0365] Fix #64757: Unexpected "Implicit use of 'self' in closure" error in closure nested in result builder
2023-04-11 09:58:13 -07:00
Pavel Yaskevich
f1892fc020 Merge pull request #65053 from xedin/cs-adjust-type-variable-printing
[ConstraintSystem] NFC: Print attributes/capabilities only for unboun…
2023-04-11 09:02:04 -07:00
Konrad `ktoso` Malawski
80b93863a9 [Concurrency] Rename Job to ExecutorJob, ease transition with typealias (#65006) 2023-04-11 14:52:10 +09:00
Pavel Yaskevich
53fdeb10b6 [ConstraintSystem] NFC: Print attributes/capabilities only for unbound type variables
Print bound type variables as `$T<Num> as <Type> @ <locator>` and
unbound ones as `$T<Num> [allows bindings to: ...] [attributes: ...] ... @ <locator>`
2023-04-10 19:15:43 -07:00
Cal Stephens
7c78ad2860 Update default value of argument 2023-04-10 16:12:43 -07:00
Pavel Yaskevich
ca14ab7157 [CSSyntaticElement] Desugar types before collecting "in scope" type variables
Generic type aliases, unless desugared, could bring unrelated type variables
into the scope i.e. `TypeAlias<$T, $U>.Context` is actually `_Context<$U>`.
These variables could be inferrable only after the the body the closure is
solved. To avoid that, let's adjust `TypeVariableRefFinder` to desugar types
before collecting referenced type variables.

Resolves: rdar://107835060
2023-04-10 15:33:03 -07:00
Allan Shortlidge
8ee6d43876 Merge pull request #65023 from tshortli/exclusivity-attribute-in-swiftinterface
Sema: Skip storage diagnostic for `@exclusivity` in swiftinterfaces
2023-04-10 15:06:48 -07:00
Konrad `ktoso` Malawski
b666fc672e [Executors] Remote distributed actors get "crash on enqueue" default executor (#64969) 2023-04-10 19:12:03 +09:00