Commit Graph

22435 Commits

Author SHA1 Message Date
Doug Gregor
e27f19520c Merge pull request #75937 from DougGregor/astgen-swiftifconfig 2024-08-21 06:34:17 -07:00
Doug Gregor
dfe17e4d39 Be consistent about deallocating memory allocated from C++ in C++
Fixes a crash on Windows due to mismatched allocators.
2024-08-20 22:12:12 -07:00
swift-ci
2ac3110e0b Merge remote-tracking branch 'origin/main' into rebranch 2024-08-20 21:13:53 -07:00
Allan Shortlidge
74d7a15337 Merge pull request #75996 from tshortli/module-interface-skip-spi-platform-attrs
ModuleInterface: Skip attributes referencing SPI platforms
2024-08-20 21:09:58 -07:00
swift-ci
1450e0889d Merge remote-tracking branch 'origin/main' into rebranch 2024-08-20 19:16:30 -07:00
Allan Shortlidge
f042ba8284 ModuleInterface: Skip attributes referencing SPI platforms.
When printing the public `.swiftinterface` for a `-library-level=api` module,
skip emitting `@available`, `@backDeployed`, and `@_originallyDefinedIn`
attributes that reference "SPI" platforms.

Resolves rdar://133990140.
2024-08-20 14:02:00 -07:00
Slava Pestov
69bd0f0f1f AST: Remove OpaqueTypeArchetypeType::getCanonicalInterfaceType() 2024-08-20 17:00:25 -04:00
swift-ci
b08f7a1307 Merge remote-tracking branch 'origin/main' into rebranch 2024-08-20 13:58:19 -07:00
Slava Pestov
43c33d78b3 AST: Calculate recursive properties for opened existential types 2024-08-20 16:54:51 -04:00
Slava Pestov
5577f27661 AST: Opened existential environments store outer substitutions 2024-08-20 16:54:51 -04:00
Slava Pestov
b434c9fb56 Merge pull request #75984 from slavapestov/clean-up-opened-archetype
Clean up OpenedArchetypeType construction and more
2024-08-20 16:52:55 -04:00
Pavel Yaskevich
f64bf5ff95 [AST] NFC: Rename ParameterInfoList::isPassedToSendableParameter to isSendableParameter
Just like other members of that type, `isPassedToSendableParameter` bit
set tracks information per parameter. The "passed" bit is applicable
to the argument rather than the parameter itself so it should bit kept
on the `AbstractClosureExpr`.
2024-08-20 13:17:04 -07:00
Slava Pestov
ff308e9510 AST: Remove TypeBase::openAnyExistentialType() 2024-08-20 12:15:27 -04:00
Slava Pestov
0c2f28fd3d AST: Remove GenericSignature parameter from OpenedArchetypeType::get() 2024-08-20 12:15:27 -04:00
Slava Pestov
db6d3e03db AST: Refactor MapLocalArchetypesOutOfContext to handle member types 2024-08-20 11:50:54 -04:00
swift-ci
5a20ae5fce Merge remote-tracking branch 'origin/main' into rebranch 2024-08-20 06:35:14 -07:00
Doug Gregor
d9f7d94ae9 Merge pull request #75413 from DougGregor/unsafe
Introduce `@unsafe` and the ability to prohibit use of unsafe entities
2024-08-20 06:14:39 -07:00
swift-ci
97eaf355ae Merge remote-tracking branch 'origin/main' into rebranch 2024-08-19 18:34:33 -07:00
Slava Pestov
f4c3d8f7d6 Merge pull request #75966 from slavapestov/more-removal-of-root
Remove some usages of ArchetypeType::getRoot()
2024-08-19 21:18:05 -04:00
Doug Gregor
571859f294 Move "unsafe" diagnostics from errors to warnings
Warnings fit better with the approach we're going for, and can be
escalated to errors by `-warnings-as-errors` for clients that need it.
2024-08-19 14:34:00 -07:00
Doug Gregor
39f1e97bf9 [Safe mode] Diagnose uses of declarations involving unsafe types
When referencing a declaration, check whether any of the types in that
reference are unsafe. This can diagnose cases where the original
declaration either wasn't actually unsafe, or is being provided with
unsafe types via generics.
2024-08-19 14:33:09 -07:00
Doug Gregor
cccf6c1114 Introduce @unsafe and the ability to prohibit use of unsafe declarations
Allow any declaration to be marked with `@unsafe`, meaning that it
involves unsafe code. This also extends to C declarations marked with
the `swift_attr("unsafe")` attribute.

Under a separate experimental flag (`DisallowUnsafe`), diagnose any
attempt to use an `@unsafe` declaration or any unsafe language feature
(such as `unowned(unsafe)`, `@unchecked Sendable`). This begins to
define a "safe" mode in Swift that prohibits memory-unsafe constructs.
2024-08-19 14:33:07 -07:00
Slava Pestov
76ec591fde AST: hasOpenedExistentialWithRoot() => hasLocalArchetypeFromEnvironment() 2024-08-19 16:55:10 -04:00
swift-ci
1bdfdbf941 Merge remote-tracking branch 'origin/main' into rebranch 2024-08-19 10:14:11 -07:00
Hamish Knight
840ed6adff Merge pull request #75891 from hamishknight/fellthrough
[Sema] Improve handling of `fallthrough` in `if`/`switch` expressions
2024-08-19 17:59:24 +01:00
swift-ci
3b35248991 Merge remote-tracking branch 'origin/main' into rebranch 2024-08-19 05:33:56 -07:00
Slava Pestov
be56e430ca ASTMangler: Compute canonical type earlier 2024-08-17 22:04:15 -04:00
Slava Pestov
547cdb976d AST: Extract TypeTransform::transformSubMap() from TypeTransform::doIt() 2024-08-17 22:04:15 -04:00
swift-ci
0ec2ef5f7a Merge remote-tracking branch 'origin/main' into rebranch 2024-08-17 18:34:42 -07:00
Slava Pestov
fc79a982de AST: Move guts of Type::transformWithPosition() into a visitor class 2024-08-17 10:49:13 -04:00
swift-ci
a5ec343a08 Merge remote-tracking branch 'origin/main' into rebranch 2024-08-17 06:14:34 -07:00
Slava Pestov
0e853a358e Merge pull request #75935 from slavapestov/remove-transform
AST: Replace remaining uses of Type::transform() with transformRec()
2024-08-17 09:11:52 -04:00
swift-ci
c19582ba53 Merge remote-tracking branch 'origin/main' into rebranch 2024-08-16 21:34:46 -07:00
Alex Hoppen
514f7bc92d Merge pull request #75793 from ahoppen/no-editor-mode
Remove `DiagnosticsEditorMode`
2024-08-16 21:25:54 -07:00
swift-ci
9b1885dd42 Merge remote-tracking branch 'origin/main' into rebranch 2024-08-16 16:35:43 -07:00
iMostfa
80a8a0746b Replace uses of the word "accessor" in diagnostics with user-facing terminology (#74462)
In this PR i worked on replacing the word accessor in diagnostics with more user-facing terminologies like setter, getter, didSet Observer, and members based on the context of the message.

in some messages i didn't need to pass DescriptiveDeclKind instead i just changed the text copy itself.

i also updated tests, so you might find it easier to check my changes this way.

Please let me know if there's something i should've done in a better way, and request changes if needed. !

i can squash my commits after reviewing getting the PR Reviewed, just to make it easier to be checked commit by commit

Resolves #55887
2024-08-16 16:29:30 -07:00
swift-ci
92d981d96d Merge remote-tracking branch 'origin/main' into rebranch 2024-08-16 16:21:32 -07:00
Alexis Laferrière
73e859a14f Merge pull request #75912 from xymus/serial-channel-diag
Serialization: reword diagnostic about serialization channel mismatch
2024-08-16 16:08:29 -07:00
swift-ci
bb96b71481 Merge remote-tracking branch 'origin/main' into rebranch 2024-08-15 17:26:32 -07:00
Michael Gottesman
03713498f7 Merge pull request #75873 from gottesmm/pr-6c64f2f0a43f93b59babd44b8bac2c396a039e2f
[region-isolation] Improve the error we emit for closure literals captured as a sending parameter.
2024-08-15 17:03:52 -07:00
swift-ci
474b11c0ba Merge remote-tracking branch 'origin/main' into rebranch 2024-08-15 16:15:10 -07:00
Rintaro Ishizaki
795bfb91ac Merge pull request #75889 from rintaro/macros-no-llvm-dylib
[Macros] Don't dlclose InProcessPluginServer shared library
2024-08-15 16:14:11 -07:00
Alexis Laferrière
020d5784df Serialization: reword diagnostic about serialization channel mismatch
This diagnostic reports when two compilers that are marked as targetting
different distribution channels try to read swiftmodules produced by the
other one. For a resilient module, this error is usually silently ignored
as the reader compiler picks the swiftinterface over the swiftmodule.
It is visibile to the end user when the module is non-resilient.
For such a case, we here try to improve the diagnostic to be more
meaningful.

The new diagnostics looks like so:
```
import ChannelLib // error: the binary module for 'ChannelLib' was compiled
                  // for 'restricted-channel', it cannot be imported by the
                  // current compiler which is aligned with 'other-channel'.
                  // Binary module loaded from path: .../ChannelLib.swiftmodule
```

Vendors should be mindful to pick meaningful channel names
to guide users in the direction of the actual solution.
2024-08-15 13:29:10 -07:00
Mykola Pokhylets
50b1313175 Merge branch 'main' into mpokhylets/isolated-deinit
# Conflicts:
#	lib/SILGen/SILGenDistributed.cpp
#	lib/Sema/TypeCheckConcurrency.cpp
2024-08-15 16:58:43 +02:00
swift-ci
cff34564bd Merge remote-tracking branch 'origin/main' into rebranch 2024-08-15 05:54:42 -07:00
Ellie Shin
93f9a17c33 Merge pull request #75872 from swiftlang/elsh/pkg-switch-enum 2024-08-15 05:48:09 -07:00
Rintaro Ishizaki
2ec4dc8d1c [Macros] Don't dlclose InProcessPluginServer shared library
llvm::DynamicLibrary does dlclose on all the libraries when global
destructor runs. Which causes dangling pointers if the library contains
Swift code.

rdar://131048379
2024-08-14 12:31:55 -07:00
Hamish Knight
769805e714 [Sema] Fully allow fallthrough in switch expressions
Allow `fallthrough` to appear as the last statement
in the case of a `switch` expression. We already
allowed it in other positions, this was just an
oversight.

rdar://127670432
2024-08-14 19:59:05 +01:00
Hamish Knight
55aed16ee6 Requestify FallthroughStmt source and destination lookup
Follow a similar pattern to BreakTargetRequest
and ContinueTargetRequest.
2024-08-14 19:59:05 +01:00
Hamish Knight
4470814db8 [Sema] Recontextualize BreakStmt + ContinueStmt in lazy vars
I don't think this currently matters, but ensure
we re-contextualize BreakStmts and ContinueStmts
in RecontextualizeClosures since these statements
store DeclContexts.
2024-08-14 19:59:05 +01:00