Commit Graph

24025 Commits

Author SHA1 Message Date
Becca Royal-Gordon
9c6b3bb6ff Adopt %kind in diag::objc_overriding_objc_decl
Slightly alters wording of a diagnostic.
2023-07-19 13:08:13 -07:00
Becca Royal-Gordon
325ab9118e [NFC] Adopt new features in availability diagnostics
Allows the removal of a helper function.
2023-07-19 13:08:12 -07:00
Becca Royal-Gordon
1d6b041e58 Reword @objcImpl diagnostics to avoid “an”
…and also adopt new DiagnosticEngine features.
2023-07-19 13:08:12 -07:00
Becca Royal-Gordon
fca140211d Adopt warnUntilSwiftVersion for diag::witness_not_usable_from_inline_warn
This changes the wording of some diagnostics in Swift 4.2 and Swift 4 modes.
2023-07-19 13:08:12 -07:00
Becca Royal-Gordon
b4855aee1f Adopt ValueDecl in autodiff diagnostics 2023-07-19 13:08:12 -07:00
Becca Royal-Gordon
025728f568 Adopt ValueDecl for invalid redeclaration errors
Causes slight changes to notes on certain `init`s.
2023-07-19 13:08:12 -07:00
Becca Royal-Gordon
09e20776cb Remove diag::descriptive_decl_declared_here
It was used in one place to handle accessors, which happily is no longer necessary.
2023-07-19 13:08:12 -07:00
Becca Royal-Gordon
1b81c3de7b [NFC] Adopt ValueDecl * for decl_declared_here 2023-07-19 13:08:12 -07:00
Becca Royal-Gordon
fc2c66f674 [NFC] Adopt %kind for Sema ValueDecl diagnostics 2023-07-19 13:08:11 -07:00
Becca Royal-Gordon
84592b8f8e Adopt %kind in Sendable checking diagnostic
Causes minor changes in diagnostic text.
2023-07-19 13:06:51 -07:00
Becca Royal-Gordon
3732c75e97 Adopt %kind for certain access control diagnostics
These particular changes slightly alter some diagnostics.
2023-07-19 13:06:51 -07:00
Becca Royal-Gordon
1318bf5bf5 [NFC] Begin adopting new diagnostics features 2023-07-19 13:06:51 -07:00
Holly Borla
9ac257baa1 [Macros] Diagnose conformance macros as being replaced by extension macros. 2023-07-19 10:02:12 -07:00
Alex Lorenz
3748b0ff1c Merge pull request #65129 from hyp/eng/no-evo-cxx
[interop] Prohibit use of C++ APIs in public interfaces that opt-in i…
2023-07-19 08:10:23 -07:00
Doug Gregor
b8b1e34cc8 Merge pull request #67389 from DougGregor/se-0401-feature-rename 2023-07-19 07:02:40 -07:00
Slava Pestov
9e73dad311 Merge pull request #67342 from slavapestov/open-type-workaround
Sema: Workaround for issue in ConstraintSystem::openType()
2023-07-19 07:49:45 -04:00
Doug Gregor
f03ad115a2 [SE-0401] Rename DisableActorInferenceFromPropertyWrapperUsage to DisableOutwardActorInference 2023-07-18 23:49:58 -07:00
Holly Borla
769fc5d2c5 Merge pull request #67383 from hborla/diagnose-undocumented-conformances
[Macros] Diagnose undocumented conformances in extension macro expansions.
2023-07-18 22:39:22 -07:00
John McCall
a934f1f66c Merge pull request #67368 from rjmccall/unimplementable-variadic-reabstraction
Diagnose attempts to reabstract variadic functions in unimplementable ways
2023-07-18 21:28:59 -04:00
Holly Borla
3c24932138 [Macros] Diagnose undocumented conformances in extension macro expansions. 2023-07-18 18:06:51 -07:00
Pavel Yaskevich
2bfbb43af5 [CodeSynthesis] Teach AreAllStoredPropertiesDefaultInitableRequest about init accessors
If stored property is covered by one or more init accessor property,
it's default initializable when at least one of the init accessor
properties has default value.
2023-07-18 17:19:42 -07:00
Pavel Yaskevich
fd2a7d5ad3 [Sema] InitAccessors: Make sure that init accessor default subsumes initialization of stored properties
Default expression associated with an init accessor property
should always subsume that of any property listed in "initializes".
2023-07-18 17:19:42 -07:00
Amritpan Kaur
e7853368db [CSSimplify] Resolve key path expression
by creating a BoundGenericType for the keypath expr
with the keypath base and replacing the value with
the value typeVar that will be resolved when the value
typeVar is directly bound.
2023-07-18 15:16:07 -07:00
Holly Borla
75ea47d875 Merge pull request #67314 from hborla/missing-peer-property-metadata
[IRGen] Visit members generated by peer macros in ClassDataBuilder.
2023-07-18 15:10:44 -07:00
Anders Bertelrud
d6e0ca3544 [PlaygroundTransform] Add experimental feature PlaygroundExtendedCallbacks to pass more info in callbacks (#67215)
* Add experimental feature `PlaygroundExtendedCallbacks` which passes more information in `-playground` callbacks

Adds the experimental feature `PlaygroundExtendedCallbacks` which (when `-playground` is also passed) causes the playground transform to use alternate forms of the result-value, scope-entry, and scope-exit callbacks that include the module name and file path of the source file.

The previous callbacks included integers for the module number and file number, but this was cumbersome to use because it required the caller to create source symbols with magical names formed from the module name and file path that the playground transform knew how to look up.

The extended callbacks in the experimental feature instead pass these strings as string literals. This is an experimental feature because of the need to measure the performance impact, and because of the need to provide an option to control which set of callbacks to use so that existing clients of the playground transform can opt into it when ready. It's also likely that we'll want to pass more information in the extended callbacks, such as an indication of the kind of result is being logged (e.g. a loop iteration variable vs a return statement vs a variable assignment). So this should be considered the first of a series of experimental improvements that will then be pitched as an actual, non-experimental v2.0 of the playground transform callback API. Because of the nature of how the playground transform is used, it's much easier to iterate on the functionality in the form of an experimental feature rather than using only desktop debug builds of the Swift compiler.

Changes:
- define a new experimental feature called `PlaygroundExtendedCallbacks`
- modify the playground transform step in sema to pass the module name and file name literals when the experimental feature is set
- add a unit test for the extended callbacks

There is no change in behaviour when `PlaygroundExtendedCallbacks` is not enabled.

rdar://109911742

Co-authored-by: Brent Shank <bshank@apple.com>
2023-07-18 11:55:26 -07:00
John McCall
1a7d44a11d Diagnose attempts to reabstract variadic function types in unimplementable ways. 2023-07-18 13:22:35 -04:00
Holly Borla
b746a034c4 [Distributed] Avoid cascading diagnostics when actorSystem is declared
explicitly.
2023-07-17 14:21:52 -07:00
Stéphan Kochen
7b460ce495 build: fix accidental cmake expansions
As of CMake 3.25, there are now global variables `LINUX=1`, `ANDROID=1`,
etc. These conflict with expressions that used these names as unquoted
strings in positions where CMake accepts 'variable|string', for example:

- `if(sdk STREQUAL LINUX)` would fail, because `LINUX` is now defined and
  expands to 1, where it would previously coerce to a string.

- `if(${sdk} STREQUAL "LINUX")` would fail if `sdk=LINUX`, because the
  left-hand side expands twice.

In this patch, I looked for a number of patterns to fix up, sometimes a
little defensively:

- Quoted right-hand side of `STREQUAL` where I was confident it was
  intended to be a string literal.

- Removed manual variable expansion on left-hand side of `STREQUAL`,
  `MATCHES` and `IN_LIST` where I was confident it was unintended.

Fixes #65028.
2023-07-17 21:50:50 +02:00
Slava Pestov
415b70584a Sema: Workaround for issue in ConstraintSystem::openType() 2023-07-17 15:33:34 -04:00
Holly Borla
58ad17a883 [Distributed] Preserve the order of the id and actor system properties
in evaluateMembersRequest.
2023-07-17 09:39:33 -07:00
Hamish Knight
067583a1e3 [CS] Merge VarRefCollector & UnresolvedVarCollector
These now do basically the same thing, merge their
implementations.
2023-07-17 17:32:47 +01:00
Hamish Knight
09bb346b03 [CS] Walk UnresolvedDeclRefExprs in UnresolvedVarCollector
This matches what we do in VarRefCollector, and is
needed because we currently delay the pre-checking
of patterns due to the fact that we don't resolve
them until CSGen. We ought to consider changing
this, but until then, adjust the logic here to
ensure we properly connect an ExprPattern that
references an outer var with any type variables
it may involve.

rdar://112264204
2023-07-17 17:32:46 +01:00
Sophia Poirier
6e47a36808 Merge pull request #67292 from sophiapoirier/pack-stored-propety-shadows-global
[ConstraintSystem] implement implicit pack materialization for abstract tuples instead of explicit '.element'
2023-07-14 15:11:05 -07:00
nate-chandler
400d3d1422 Merge pull request #67272 from nate-chandler/rdar112152116
[Sema] Allow implicit dynamic @nonobjc.
2023-07-14 10:49:19 -07:00
Sophia Poirier
fa41015ae4 [ConstraintSystem] implement implicit pack materialization for abstract tuples instead of explicit '.element' 2023-07-14 10:32:38 -07:00
Ben Barham
f7334a1968 Merge pull request #67299 from ahoppen/ahoppen/result-builder-signature-crash
[CodeComplete] Fix a crash when completing in the signature of a function annotated with result builder
2023-07-14 10:31:20 -07:00
Holly Borla
c55d0e2e44 Merge pull request #67106 from hborla/validate-extension-macros
[Macros] Add missing macro validation.
2023-07-14 07:53:43 -07:00
Alex Hoppen
f212dd8b1a [CodeComplete] Fix a crash when completing in the signature of a function annotated with result builder
When we are completing inside a function signature, the function doesn’t have a body. We were still running `PreCheckResultBuilderApplication`, which crashed if the body was `nullptr`.

rdar://111489024
2023-07-14 12:58:03 +02:00
Holly Borla
04ea8b0a67 [Macros] Diagnose macros attached to declarations they cannot apply to. 2023-07-13 17:07:24 -07:00
Holly Borla
05c3ffc749 [Macros] Validate that extension macro expansions only include names covered
by the macro declaration.
2023-07-13 06:59:18 -07:00
Slava Pestov
aa026f4d06 Merge pull request #67266 from slavapestov/transform-type-parameter-packs
Fix various places where we didn't handle "bound" pack references correctly
2023-07-13 08:09:04 -04:00
Allan Shortlidge
e973ff941f Merge pull request #67225 from tshortli/allow-usable-from-inline-access-in-default-args
Sema: Allow default arguments to access `@usableFromInline` decls
2023-07-12 20:40:24 -07:00
Michael Gottesman
377d5e1148 Merge pull request #67203 from gottesmm/pr-926bc2579371ebafa050d23a22d39b2a177ecd6a
[reference-bindings] Inout Binding ensure that we handle fields correctly
2023-07-12 15:06:59 -07:00
Slava Pestov
8a132c0248 Sema: Replace some usages of mapPackTypeIntoElementContext() with mapContextualPackTypeIntoElementContext() 2023-07-12 18:02:14 -04:00
Konrad `ktoso` Malawski
2044cb78cf Merge pull request #66934 from kabiroberai/main 2023-07-13 06:53:23 +09:00
Nate Chandler
8b662a7fea [Sema] Allow implicit dynamic @nonobjc.
Back in https://github.com/apple/swift/pull/24959, marking a decl both
dynamic and @nonobjc was allowed.  So implicitly mark decls that are
@nonobjc dynamic when -enable-implicit-dynamic is specified.

rdar://112152116
2023-07-12 14:23:50 -07:00
Allan Shortlidge
496d29c47f AST: Remove FragileFunctionKind.allowUsableFromInline.
It was effectively always true after allowing default argument expressions to
reference `@usableFromInline` decls.
2023-07-12 12:47:06 -07:00
Alex Lorenz
4d084100ce [cxx-interop] Mark C++ functions with unavailable return type as unavailable
This prevents users from calling functions with unsupported or unavailable return types. This ensures that users don't for example call a function that returns a non-copyable and non-movable type

Fixes https://github.com/apple/swift/issues/64401
2023-07-11 16:40:57 -07:00
Michael Gottesman
c8f50b3814 [reference-bindings] Make the never mutated diagnostic only apply to vars, not also to inout bindings. 2023-07-11 13:27:51 -07:00
Pavel Yaskevich
4760b95282 Merge pull request #67183 from xedin/convert-effects-into-storageRestrictions
[AST/Sema] Implement @storageRestrictions attribute
2023-07-11 11:57:14 -07:00