Commit Graph

47194 Commits

Author SHA1 Message Date
swift-ci
2deb2f9a87 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-19 22:17:53 -07:00
Kavon Farvardin
889baf7f2c Merge pull request #84411 from kavon/copyprop-onone
sil: provide ability to run CopyPropagation in -Onone
2025-09-19 22:09:59 -07:00
swift-ci
ce0f17aeac Merge remote-tracking branch 'origin/main' into rebranch 2025-09-19 21:35:40 -07:00
Henrik G. Olsson
7fcc72f108 Merge pull request #81859 from swiftlang/swiftify-inherit-imports
[MacrosOnImports][Swiftify] Copy module imports from clang node's module to its Swift macro SourceFile
2025-09-19 21:21:09 -07:00
swift-ci
0292981879 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-19 16:35:25 -07:00
Alexis Laferrière
97002e1ee0 Merge pull request #84373 from xymus/le-import-warn
Sema: Limit errors on LE importing non-LE modules to SDK modules
2025-09-19 16:34:48 -07:00
Kavon Farvardin
4a943d464d sil: provide ability to run CopyPropagation in -Onone
This does not enable it by default. Use either of the flags:

```
-enable-copy-propagation
-enable-copy-propagation=always
```

to enable it in -Onone. The previous frontend flag
`-enable-copy-propagation=true` has been renamed to
`-enable-copy-propagation=optimizing`, which is currently default.

rdar://107610971
2025-09-19 16:23:19 -07:00
swift-ci
9be21897d9 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-19 15:20:12 -07:00
Hamish Knight
801cd646ad Merge pull request #84390 from hamishknight/out-of-place
[Sema] Reject placeholders in type resolution for param and result types
2025-09-19 23:19:48 +01:00
swift-ci
647f66ad2b Merge remote-tracking branch 'origin/main' into rebranch 2025-09-19 14:18:04 -07:00
Slava Pestov
21e34e3189 Merge pull request #84400 from slavapestov/prepared-overloads-flag
Sema: Add -solver-{enable,disable}-prepared-overloads frontend flags
2025-09-19 17:13:23 -04:00
swift-ci
80f659cce2 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-19 12:18:05 -07:00
fahadnayyar
7b8b33eda0 [cxx-interop] Allow SWIFT_RETURNS_(UN)RETAINED on template class member functions returning T* (#84375)
When importing C++ template classes like`Ref<T>` that have methods
returning `T*`, we face the following situation when `T` is a
`SWIFT_SHARED_REFERENCE` type:

1. Without `SWIFT_RETURNS_(UN)RETAINED` annotation: Swift compiler would
emit a warning (currently under experimental-feature flag
`WarnUnannotatedReturnOfCxxFrt`) _"cannot infer the ownership of the
returned value" when T is a SWIFT_SHARED_REFERENCE type_
2. With annotation: Compiler rejects it with this error: _"cannot be
annotated... not returning a SWIFT_SHARED_REFERENCE type"_

This affects WebGPU's smart pointer types (`WTF::Ref<T>,
WTF::RefPtr<T>`) and similar patterns in other C++ codebases.

In this patch I am fixing the logic for diagnostic
`returns_retained_or_returns_unretained_for_non_cxx_frt_values`. I'm
also making it a warning instead of an error to minimize the risk, as
this diagnostic has been a hindrance to the adoption of these
annotations in real codebases when templated functions and types are
involved. (Refer to
[PR-78968](https://github.com/swiftlang/swift/pull/78968))

rdar://160862498
2025-09-19 12:09:05 -07:00
swift-ci
3a31109821 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-19 10:35:08 -07:00
Anthony Latsis
b7b4b57799 Merge pull request #84391 from swiftlang/jepa-main5
tools: Set Swift bug report message in some executable targets
2025-09-19 18:15:20 +01:00
Hamish Knight
0b3747d7c4 Revert "[CS] Record fix when encountering decl reference with placeholder type"
This reverts commit 8102e39f39.
2025-09-19 14:22:39 +01:00
Hamish Knight
62798494ff Revert "[Sema] Handle PlaceholderTypes in associated type inference"
This reverts commit aa9aa58cea.
2025-09-19 14:22:39 +01:00
Hamish Knight
46df852610 [Sema] Reject placeholders in type resolution for param and result types
Not all clients can properly handle the presence of placeholders in
interface types and it doesn't seem worth the complexity for the 
type replacement diagnostic.
2025-09-19 14:22:39 +01:00
Anthony Latsis
ea5d89d0d0 tools: Set Swift bug report message in some executable targets
If these programs crash, we want them to print the Swift bug report
message, not the default LLVM one, which leads to
https://github.com/llvm/llvm-project/issues.

While here, hoist the setting of the bug report message to the
START_PROGRAM macro so that we don't forget to set it in the future.
2025-09-19 12:05:31 +01:00
swift-ci
e7eb500826 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-19 01:14:59 -07:00
Doug Gregor
3e981b7d8f Merge pull request #84374 from DougGregor/embedded-swift-restrictions
Embedded swift restrictions
2025-09-19 01:09:19 -07:00
swift-ci
3ac38cb3c4 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-18 21:16:38 -07:00
Slava Pestov
cf3dab10bb Merge pull request #84339 from slavapestov/better-prepared-overloads
Sema: Better prepared overloads
2025-09-18 21:47:06 -04:00
swift-ci
ca93b4b068 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-18 16:17:26 -07:00
Kavon Farvardin
84cf0a3551 Merge pull request #81858 from kavon/kavon/manual-ownership
introduce @_manualOwnership performance attribute
2025-09-18 16:15:20 -07:00
swift-ci
0ccd741ed2 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-18 12:37:37 -07:00
Hamish Knight
ed1a372ed3 Merge pull request #84368 from hamishknight/unresolved 2025-09-18 20:30:54 +01:00
Slava Pestov
2deb5ff0a5 Sema: Add -solver-{enable,disable}-prepared-overloads frontend flags 2025-09-18 15:05:43 -04:00
Slava Pestov
9dea72579a Sema: Record ASTNode type changes in PreparedOverload
Also, move some methods from ConstraintSystem.h to ConstraintSystem.cpp.
2025-09-18 14:54:16 -04:00
Slava Pestov
a12c160d0b Sema: Replace calls to OverloadChoice constructor with two overloads of getDecl() 2025-09-18 14:54:16 -04:00
Slava Pestov
b181fcf0fd Sema: Get prepared overloads working again with the Pre()/Post() split 2025-09-18 14:54:16 -04:00
swift-ci
7e9a19e7d7 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-18 11:35:00 -07:00
Allan Shortlidge
292dd23008 Merge pull request #84294 from rjmansfield/fix-helptext-typos
Fix various HelpText typos.
2025-09-18 11:28:15 -07:00
Doug Gregor
a16c9f7ab4 [Embedded] Diagnose dynamic casts to existentials
Embedded Swift doesn't have protocol conformance metadata, so it cannot
handle dynamic casts to existentials (nor should it).

Another part of rdar://119383905.
2025-09-18 10:05:35 -07:00
Doug Gregor
74d5ee26f0 [Embedded] Downgrade type-checker error about non-final generic class methods to a warning
The existing SIL-level diagnostic for this check only triggers when
the type is actually used, while the type-checker version is more
eager. Stage in the stricter check as a warning and we'll clamp down
on things later.
2025-09-18 10:05:35 -07:00
Doug Gregor
ade6e55b0c [Embedded] Diagnose uses of generic methods on existential values
Generic methods declared in protocols (and extensions thereof) cannot
be used on existential values, because there is no way to specialize
them for all potential types. Diagnose such cases in Embedded Swift
mode and via `-Wwarning EmbeddedRestrictions`.

This adds a bunch more warnings to the standard library that we'll
need to clean up, probably by `#if`'ing more code out.

Part of rdar://119383905.
2025-09-18 10:05:35 -07:00
Doug Gregor
844ba5f4f8 [Embedded] Diagnose non-final generic methods in class in the type checker
Move the diagnostic about non-final generic methods in classes up to
the type checker, so that it is available to `-Wwarning
EmbeddedRestrictions` and earlier in the pipeline. The SIL version of
this is still available as a backstop.

Yet another part of rdar://133874555.
2025-09-18 10:05:33 -07:00
Doug Gregor
c8e6bfd814 Put SIL diagnostics involving Embedded Swift restrictions into the appropriate group
Embedded Swift must defer some of the diagnostics about its
restrictions to late in the optimization pipeline, because some
source-level constructs (such as metatypes) are allowed in specific
cases that cannot be diagnosed in the type checker.

Put these diagnostics into the same EmbeddedRestrictions diagnostic
group as the type checker diagnostics, because that's the central
point at which we can direct folks to more information about the
restrictions in Embedded Swift.

Addresses rdar://119383905.
2025-09-18 10:05:20 -07:00
Alexis Laferrière
3a7cf4747c Sema: Reorder the cases of LibraryLevel from less to more public 2025-09-18 09:39:35 -07:00
Slava Pestov
c344d6b0eb Sema: Rename getTypeOf{Member,}ReferenceImpl() to Pre() and factor out Post() versions 2025-09-18 11:31:59 -04:00
Slava Pestov
182c38470b Sema: Remove replacementsPtr parameter from getTypeOfMemberReference() 2025-09-18 11:31:59 -04:00
Slava Pestov
a028eb36b7 Sema: Don't need to return new baseObjTy from getTypeOfMemberReferenceImpl() 2025-09-18 11:31:59 -04:00
Slava Pestov
d8ead6c5cc Sema: Refactor getTypeOf{Member,}Reference() to take the OverloadChoice 2025-09-18 11:31:59 -04:00
Slava Pestov
2fde4a50e7 Sema: Split off getTypeOfMemberReferenceImpl() from getTypeOfMemberReference() 2025-09-18 11:06:32 -04:00
Slava Pestov
35a439de24 Sema: Remove replacements parameter from getMemberReferenceTypeFromOpenedType() 2025-09-18 11:06:31 -04:00
Slava Pestov
1efc9a6d0d Sema: Split off getTypeOfReferenceImpl() from getTypeOfReference() 2025-09-18 11:06:31 -04:00
swift-ci
7b8b46694b Merge remote-tracking branch 'origin/main' into rebranch 2025-09-18 06:36:53 -07:00
Hamish Knight
deab5f7970 Merge pull request #84280 from hamishknight/csapply-cleanup
Reapply: [Sema] Remove some unreachable code from CSApply
2025-09-18 14:25:51 +01:00
swift-ci
9e3d4161b5 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-18 05:03:55 -07:00
Hamish Knight
a976af09ba [IDE] Ignore unresolved types in WithSolutionSpecificVarTypesRAII
Make sure we don't try to set an UnresolvedType as a VarDecl interface
type in WithSolutionSpecificVarTypesRAII.
2025-09-17 23:00:27 +01:00