Commit Graph

87043 Commits

Author SHA1 Message Date
Michael Gottesman
fb487bf0ef [move-only] Improve logging to make it more readable and add a counter to bisect on variables that we are checking.
These are only on in NDEBUG mode. It just makes it easier to quickly triage
which variable is causing a checking problem.
2023-07-03 15:49:41 -07:00
Holly Borla
3ab4e71d75 Merge pull request #67070 from hborla/refine-extension-macros
[Macros] Allow `extension` macros to suppress conformances that are stated in the original source.
2023-07-02 20:47:07 -07:00
Meghana Gupta
17cba8540d Merge pull request #67072 from meg-gupta/forwardingwrappertypepr
Introduce ForwardingOperation wrapper type
2023-07-01 23:33:50 -07:00
Meghana Gupta
07863444d2 Introduce ForwardingOperation wrapper type
APIs on ForwardingInstruction should be written as static taking in
a SILInstruction as a parameter making it awkward.

Introduce a ForwardingOperation wrapper type and move the apis from the
old "mixin" class to the wrapper type.

Add new api getForwardedOperands()
2023-07-01 10:42:38 -07:00
Puyan Lotfi
66a7ebe3a6 Merge pull request #67036 from plotfi/ns-options-type-import-inside-objc-interface
[cxx-interop] Import ObjCPropertyDecl of type NS_OPTIONS fields as struct type
2023-07-01 02:01:14 -04:00
Holly Borla
680c0b2a2f [Macros] Add a request to get the resolved constraint types in the 'conformances:'
list of an attached extension macro attribute.
2023-06-30 22:27:16 -07:00
Holly Borla
0bd898eb12 [Macros] Allow extension macros to suppress conformances that are already
stated in the original source.

If an extension macro can introduce protocol conformances, macro expansion
will check which of those protocols already have a stated conformance in the
original source. The protocols that don't will be passed as arguments to
extension macro expansion, indicating to the macro that it should only add
conformances to those protocols.
2023-06-30 16:01:15 -07:00
Puyan Lotfi
7cef628f94 [cxx-interop] Import ObjCPropertyDecl of type NS_OPTIONS fields a struct type
Try importing ObjCPropertyDecl field types the C++-Interop-NS_OPTIONS
way. This will fix cases such as:

```
import UIKit

func f(gesture: UISwipeGestureRecognizer,
       direction: UISwipeGestureRecognizer.Direction) {
  gesture.direction = direction // error
}
```

because it will make sure the field inside class UIGestureRecognizer is
of the enum-struct type and not the typedef-rawValue type when importing
an ObjC class.
2023-06-30 17:51:37 -04:00
Holly Borla
e44c11f56f [Macros] Remove the ExpandConformanceMacros request. 2023-06-30 14:25:14 -07:00
Holly Borla
c3e214cbde [Macros] Expand conformance macros as extension macros.
ConformanceMacro now refines ExtensionMacro, so these roles can share
the same expansion request.
2023-06-30 14:25:14 -07:00
swift-ci
a9df3e2256 Merge pull request #67034 from artemcm/SimplifyConstExtractOpaqueTypes
[Compile Time Constant Extraction] Refactor collection of opaque type requirements to rely on pre-built Generic Signatures
2023-06-30 13:50:20 -07:00
Doug Gregor
139672f854 Merge pull request #67055 from DougGregor/rename-observation-module
[SE-0395] Rename _Observation module to Observation
2023-06-30 13:45:16 -07:00
Puyan Lotfi
ec5b7b0330 [NFC][cxx-interop] Refactor NS_OPTION type import handling code to be reusable.
Zoe did a nice fix on https://github.com/apple/swift/pull/66452
that I would like to reuse for ObjCPropertyDecl field types in
importObjCPropertyDecl as well. This will fix cases such as:

```
import UIKit

func f(gesture: UISwipeGestureRecognizer,
       direction: UISwipeGestureRecognizer.Direction) {
  gesture.direction = direction // error
}
```

because it will make sure the field inside class UIGestureRecognizer is
of the enum-struct type and not the typedef-rawValue type when importing
an ObjC class.
2023-06-30 16:40:43 -04:00
Slava Pestov
8d713c3575 Merge pull request #67005 from slavapestov/lookup-visible-members-cleanup
Sema: Use getAllMembers() from collectVisibleMemberDecls()
2023-06-30 16:02:52 -04:00
Steven Wu
c470c81b9c Merge pull request #66940 from cachemeifyoucan/eng/PR-dep-sharing-serivce-issue
[CAS][DependencyScanning] Don't keep a shared state of common file deps
2023-06-30 11:56:14 -07:00
Pavel Yaskevich
fab9e4bc62 Merge pull request #66987 from xedin/refactor-init-accessors-to-carry-more-info
[SIL] InitAccessors: Refactor `assign_or_init` instruction to carry "self"
2023-06-30 11:46:01 -07:00
Steven Wu
94e8ddcf0b Merge pull request #67041 from cachemeifyoucan/eng/PR-fix-cas-depscan-edge-cases
[DepScan][CAS] Fix some cases in cas-based depscanning
2023-06-30 11:41:10 -07:00
Artem Chikin
72ed4e37ff [Compile Time Constant Extraction] Refactor collection of opaque type requirements
To reduce duplication of logic with other parts of the compiler, instead of destructuring the constraint type, write the requirements in the opaque type declaration's generic signature.
2023-06-30 11:02:24 -07:00
Doug Gregor
6265f0c542 [SE-0395] Rename _Observation module to Observation
The review of SE-0395 is down to small details at this point that won't
affect the overall shape of the API much. Rename the model in
anticipation of that.
2023-06-30 11:01:02 -07:00
John McCall
61e8585352 Merge pull request #67040 from rjmccall/variadic-tuple-result-reabstraction-thunks
Handle variadic tuples in reabstraction thunk emission
2023-06-30 13:57:48 -04:00
Slava Pestov
89ad597fe3 Sema: Use getAllMembers() from collectVisibleMemberDecls()
I had to disable typo correction in one test case to get it to pass without
diagnosing a cycle as a result of Sendable checking. But that's OK, because:

- Sendable checking is prone to request cycles and needs to be redesigned
- Typo correction is turned off in production
2023-06-30 12:40:34 -04:00
Slava Pestov
fdb42fe031 Sema: Fix weird logic in TypeChecker::addImplicitConstructors() 2023-06-30 12:40:13 -04:00
Steven Wu
dfd11cfec4 [DepScan] Add missing field in JSON output
SwiftSourceModule can contain "commandLine" field and add that into the
JSON output format.
2023-06-30 09:09:27 -07:00
Joe Groff
421c762862 Merge pull request #67031 from jckarter/allocbox-to-stack-remove-unused-original-bodies
AllocBoxToStack: Remove bodies of closure functions left unused after specialization.
2023-06-30 08:30:42 -07:00
Slava Pestov
6f8fd07bdf Merge pull request #67037 from slavapestov/type-array-view
AST: Replace TypeArrayView<GenericTypeParamType> with ArrayRef<GenericTypeParamType *>
2023-06-30 08:33:31 -04:00
Slava Pestov
452ee89c40 Merge pull request #66915 from slavapestov/rdar111219086
SIL: Pass SubstFlags::PreservePackExpansionLevel in a few places
2023-06-30 05:10:00 -04:00
Slava Pestov
e05e3cd9b7 Merge pull request #67028 from slavapestov/fix-some-warnings
Fix some random compiler warnings
2023-06-30 05:09:46 -04:00
John McCall
c0777e611d Handle vanishing and variadic tuple results in reabstraction thunks.
Fixes rdar://110391963
2023-06-30 02:08:57 -04:00
John McCall
65e2e8c2fe Fix some SILArgument infrastructure for pack results.
Getting this right convinces the memory verifier to not complain
about untouched empty pack result arguments, which should be
innocuous.
2023-06-30 02:08:57 -04:00
Dario Rexin
36914d9a68 Merge pull request #67039 from drexin/wip-mp-gen-destr-inject-tag
Support destructiveInjectEnumTag in generic multi payload enums with layout strings
2023-06-29 19:20:38 -07:00
Dario Rexin
cdcba010db Merge pull request #67027 from apple/drexin-patch-6
[IRGen] Fix getEnumTag witness function selection
2023-06-29 17:09:42 -07:00
Steven Wu
0876a3e04f Fix the command-line option from depscanner after caching option rename 2023-06-29 16:51:28 -07:00
John McCall
e14f2bc0c7 [NFC] Add a method to just ask if a tuple AP vanishes under substitution 2023-06-29 19:39:51 -04:00
Dario Rexin
707330c8bd [IRGen] Emit swift_multiPayloadEnumGeneric_destructiveInjectEnumTag
Assign swift_multiPayloadEnumGeneric_destructiveInjectEnumTag as witness function on generic multi payload enums when using layout strings
2023-06-29 16:34:18 -07:00
Dario Rexin
622f7a26e9 Merge pull request #67022 from drexin/wip-sp-gen-destr-inject-tag
Support destructiveInjectEnumTag in generic single payload enums with layout strings
2023-06-29 16:33:30 -07:00
Slava Pestov
8afff61699 AST: Replace TypeArrayView<GenericTypeParamType> with ArrayRef<GenericTypeParamType *>
This basically undoes 3da6fe9c0d, which in hindsight was wrong.

There were no other usages of TypeArrayView anywhere else except for
GenericSignature::getGenericParams(), and it was almost never what
you want, so callers had to convert back and forth to an ArrayRef.
Remove it.
2023-06-29 19:23:44 -04:00
Rintaro Ishizaki
e404c995fc Merge pull request #67025 from rintaro/macros-public-message
[Macros] Unify PluginMessages.swift
2023-06-29 16:22:51 -07:00
Joe Groff
bd5f0a7af0 AllocBoxToStack: Remove bodies of closure functions left unused after specialization.
We can't remove the functions at this point in case they might have other function
passes enqueued to run on them, but we can at least remove the function contents
that are now unnecessary. We need to do this in cases when move-only types are
involved, since the semantics of the move checker rely on unescaped captures being
promoted before the pass runs, and we leave behind invalid SIL in the unpromoted code.
rdar://110675352
2023-06-29 13:45:07 -07:00
Slava Pestov
5ce14265e4 Fix some random compiler warnings 2023-06-29 16:29:10 -04:00
Slava Pestov
2146a5a8e7 AST: Remove some usages of SubstFlags::PreservePackExpansionLevel 2023-06-29 16:25:41 -04:00
Rintaro Ishizaki
3e9c2536f6 [Macros] Unify PluginMessages.swift
Use PluginMessages.swift in swift-syntax consistently.
2023-06-29 13:04:10 -07:00
Dario Rexin
21ce1b63a0 [IRGen] Fix getEnumTag witness function selection
When a type is not runtime instantiated and we are not able to compute a layout string for it, we can't assign it a layout string witness function.
2023-06-29 12:56:49 -07:00
Pavel Yaskevich
c50263c730 Merge pull request #66971 from xedin/fix-specialization-issues
[ConstraintSystem] Fix a couple of issues related to generic specialization
2023-06-29 12:25:11 -07:00
Slava Pestov
1646085ba7 AST: Replace SubstitutionMap::hasOpenedExistential() with SubstitutionMap::hasLocalArchetypes() and actually use it 2023-06-29 14:54:27 -04:00
Dario Rexin
8ccaad1db5 [IRGen] Emit swift_singlePayloadEnumGeneric_destructiveInjectEnumTag
Assign swift_singlePayloadEnumGeneric_destructiveInjectEnumTag as witness function on generic single payload enums when using layout strings
2023-06-29 10:39:54 -07:00
Meghana Gupta
5c743650ec Merge pull request #66995 from meg-gupta/removeselectmixin
Simplify select_enum forwarding instruction
2023-06-29 09:52:49 -07:00
eeckstein
7fcfcdeecf Merge pull request #66990 from eeckstein/bare-objects
SIL: add a `bare` attribute to `global_value` and `alloc_ref`
2023-06-29 18:48:44 +02:00
Zoe Carver
29c0b0d75f Merge pull request #66896 from zoecarver/fix-ambiguous-math-func
[cxx-interop] Pull over fix from 8e7766b and apply to strstr, sin, an…
2023-06-29 09:03:17 -07:00
Holly Borla
7a46466b65 Merge pull request #66967 from hborla/extension-macro
[Macros] Generalize `conformance` macros as `extension` macros
2023-06-29 08:57:04 -07:00
Kuba (Brecka) Mracek
d427696bf9 Allow @_silgen_name to be used on globals and add a @_silgen_name(raw: ...) version that skips mangling (#66540)
Attribute @_silgen_name is today only allowed to be used on functions, this change allows usage on globals as well. The motivation for that is to be able to "forward declare" globals just like it's today possible to do with functions (for the cases where it's not practical or convenient to use a bridging header).

Separately, this change also adds a @_silgen_name(raw: ...) syntax, which simply avoids mangling the name (by using the \01 name prefix that LLVM uses). The motivation for that is to be able to reference the "magic Darwin linker symbols" that can be used to look up section bounds (in the current dylib/module) -- those symbols don't use the underscore prefix in their mangled names.
2023-06-29 08:37:51 -07:00