Commit Graph

7628 Commits

Author SHA1 Message Date
Slava Pestov
4655fc359b Sema: Make a couple of TypeResolver methods idempotent
When emitting a diagnostic, mark the TypeRepr as invalid and
return an ErrorType to ensure that the diagnostic is not
emitted again, and to muffle downstream diagnostics.
2022-02-15 04:02:46 -05:00
Guillaume Lessard
d870a9f164 Merge pull request #41288 from glessard/sr15433
[stdlib] Implement `withContiguousStorageIfAvailable` for raw buffer types
2022-02-14 15:37:27 -07:00
Slava Pestov
5fa5ff7ce1 RequirementMachine: Update tests for protocol typealiases 2022-02-13 09:50:16 -05:00
Slava Pestov
f13f3bd898 Merge pull request #41332 from slavapestov/rqm-typealias-cycle-fix
Sema: Fix request cycle involving protocol typealiases in preparation for RequirementMachine support
2022-02-11 16:44:40 -05:00
Slava Pestov
6c714f4087 Sema: Try to avoid calling getGenericSignature() when performing structural resolution 2022-02-11 08:15:50 -05:00
Slava Pestov
7e733c424e RequirementMachine: compiler_crashers_2_fixed/0074-rdar28544316.swift now type checks; move it to test/Generics/ 2022-02-10 20:00:15 -05:00
Rintaro Ishizaki
6f1bca2296 [Test] Disable failing test while investigating
rdar://88581116
2022-02-09 10:10:21 -08:00
Guillaume Lessard
85250c7d26 [test] withContiguousStorage methods on raw buffer types 2022-02-08 18:05:02 -07:00
Guillaume Lessard
eb56bf3a79 [gardening] deallocate buffer after use 2022-02-08 18:05:02 -07:00
Guillaume Lessard
cec7b4b44b [gardening] silence unused variable warning 2022-02-08 18:05:02 -07:00
Guillaume Lessard
8552044dc5 Merge pull request #40828 from glessard/sort-optimization
[nfc] document legacy ABI in the implementation of sort
2022-02-08 16:17:05 -07:00
Guillaume Lessard
b9eed4fa55 [test] add ABI validation for the internals of sort() 2022-02-07 02:52:36 -07:00
Guillaume Lessard
1161f92bd7 Merge pull request #39529 from glessard/se-withMemoryRebound 2022-02-05 09:01:05 -07:00
Kavon Farvardin
13dd3d9ecf have the inferred isolation for properties change only in Swift 6
This patch delays the removal of redundant isolation for inferred
global-actor isolation to Swift 6 too, since we only warn about it
changing in Swift 5. Otherwise, only isolation that is a byproduct
of inference no longer needs an await, which will probably confuse
people.

This change is with respect to SE-327, which argues that the
non-static stored properties of ordinary structs do not need
global-actor isolation.
2022-02-04 14:43:12 -07:00
Kavon Farvardin
19bdfb1172 In a property-wrapper, global-actor isolation remains on wrappedValue
If a struct is a property-wrapper, then global-actor isolation
still applies to the `wrappedValue`, even if it's a stored property.
This is needed in order to support the propagation of global-actor
isolation through the wrapper, even when the programmer has opted
to use a stored property instead of a computed one for the
`wrappedValue`. Since this propagation is a useful pattern, I think
this exception is reasonable.
2022-02-04 14:41:49 -07:00
Guillaume Lessard
72f4e65eba [test] assumingMemoryBound on raw memory buffers 2022-02-03 20:02:33 -07:00
Guillaume Lessard
9f2c4b5959 [test] rebinding raw memory 2022-02-03 20:02:33 -07:00
Guillaume Lessard
69aa3c36bc [test] rebinding typed memory to wider and narrower types 2022-02-03 20:02:33 -07:00
Holly Borla
cd84df54bf [Sema] Don't wrap class types in existential types.
This could happen previously when computing the existential type
for a given archetype. In cases where an archetype is only constrained
to a class, return the class type directly rather than wrapping it
in an existential type.
2022-02-02 13:17:50 -08:00
Pavel Yaskevich
48ffeddbc7 [CSApply] Result coercion check should always use resolved type
`shouldCoerceToContextualType` used `solution.getType(ASTNode)`
which returns a type that has type variables in it. To properly
check whether result type needs a coercion it has to be resolved
first which is done via `solution.getResultType(ASTNode)`.

Resolves: rdar://88285682
2022-01-31 14:42:27 -08:00
Slava Pestov
f33eb17b75 GSB: Remove unsound cycle-breaking hack 2022-01-25 21:28:52 -05:00
Robert Widmann
3165ea5c9c Merge pull request #40971 from CodaFi/hitting-the-stacks
Add a Recursion Breaker to Opaque Type Substitution
2022-01-25 18:18:12 -08:00
Robert Widmann
ad94cbd415 Add a Recursion Breaker to Opaque Type Substitution
The current check in MiscDiagnostics can only handle local 2-cycles as in:

func foo() -> some P { return bar() }
func bar() -> some P { return foo() }

Larger cycles, such as the 3-cycle present in the validation test in this patch cannot be detected without resolving all substitutions up front. Therefore, we take the tact that we can at least prevent the compiler from crashing. At runtime, instead, type resolution will blow out the stack.

The check here is simple: Plumb through a set of opaque type decls that the resolution machinery has already seen, and if we encounter a recursive opaque type substitution bail with the original opaque type.

rdar://87121502
2022-01-25 13:01:39 -08:00
Alejandro Alonso
81ba0cee34 Disable unsupported_opened_existential.swift
disable only for asserts

one more time
2022-01-24 17:22:25 -08:00
Holly Borla
a8cde123c5 Merge pull request #40925 from hborla/escaping-archetype-type-variables
[Sema] Construct `OpenedArchetypeType` with a canonical existential type.
2022-01-20 09:22:33 -08:00
Holly Borla
b3b24a78cd [Test] Add a compiler crasher test case for unsupported opened existential
types.
2022-01-19 22:53:59 -08:00
Slava Pestov
e4973158d8 AST: -debug-generic-signatures protocol-qualifies DependentMemberTypes 2022-01-19 22:36:15 -05:00
Alejandro Alonso
54ff7cfa2c Add availability around the indic sequence tests 2022-01-18 22:17:07 -08:00
Slava Pestov
5cd14952a2 Add regression test for fixed crasher - rdar://46714549 2022-01-16 22:17:15 -05:00
swift-ci
da38e8c3fe Merge pull request #40869 from nate-chandler/wrangle/20220114/1 2022-01-15 03:30:51 -08:00
Nate Chandler
1d939d4201 [Test] Run in right contexts.
The validation-test/SILOptimizer/lexical-lifetimes.swift test uses
concurrency features.  Specified where that means the test can run
appropriately.
2022-01-14 18:31:33 -08:00
Pavel Yaskevich
3b381f7876 [TypeChecker] NFC: Add a slow perf test related to operator >= 2022-01-13 12:13:16 -08:00
Slava Pestov
d6e0a9103a Merge pull request #40827 from slavapestov/subst-builtin-conformance
AST: Implement ProtocolConformance::subst() for BuiltinProtocolConformances
2022-01-13 00:00:35 -05:00
swift-ci
4fe523bc98 Merge pull request #40826 from nate-chandler/wrangle/20220112/1 2022-01-12 19:13:57 -08:00
Slava Pestov
e387e72a40 AST: Implement ProtocolConformance::subst() for BuiltinProtocolConformances
Fixes https://bugs.swift.org/browse/SR-15628 / rdar://problem/87094438
2022-01-12 16:55:49 -05:00
Nate Chandler
9b021c9ba7 [Test] Eased check assertion. 2022-01-12 13:15:57 -08:00
Slava Pestov
3a92d2fc53 AST: Remove legacy GSB-based GenericSignature query implementation 2022-01-12 12:33:34 -05:00
Alejandro Alonso
6ca7366cd8 Merge pull request #40746 from Azoy/indic-grapheme-clusters
[stdlib] Implement the Indic grapheme breaking rules
2022-01-11 12:50:02 -08:00
nate-chandler
79f9a5937a Merge pull request #40744 from nate-chandler/lexical_lifetimes/test/verification/20220105/1
[Test] Checked variable lifetimes extend self.
2022-01-10 14:16:48 -08:00
Pavel Yaskevich
9f7d3fccad Merge pull request #40708 from xedin/disable-multi-stmt-inference-inside-result-builder-bodies
[ConstraintSystem] SE-0326: Temporarily prevent multi-statement closure inference in result builder contexts
2022-01-06 01:04:22 -08:00
Alejandro Alonso
4a451829f8 Implement the Indic grapheme breaking rules 2022-01-05 16:18:54 -08:00
Nate Chandler
cb205a6ec0 [Test] Checked variable lifetimes not extend weak.
Verified that lexical lifetimes DO NOT result in a method call to a weak
reference resulting in a strong reference to the object.  Consequently,
even with lexical lifetimes enabled, it is still possible, within a
single scope, for the first method call to an object weakly referenced
to occur but for the second such call not to because the object will
have been deallocated.
2022-01-05 13:00:35 -08:00
Nate Chandler
f48f3ad228 [Test] Checked variable lifetimes extend self.
Verified that when a __consuming method calls a function which takes a
closure that captures self weakly, self is not deallocated until the
call returns.  (Note that this is a behavioral change from what occurs
when lexical borrow scopes are disabled; in that case, self is
deallocated before the call to the function.)
2022-01-05 12:12:01 -08:00
Kuba (Brecka) Mracek
2653b5b931 Propagate SWIFT_ENABLE_REFLECTION into validation-test tests (#40737) 2022-01-05 11:35:44 -08:00
Pavel Yaskevich
fe9224d6a8 [TypeChecker] NFC: Add a test-case for mixed SwiftUI + multi-statement closures
This test-case used to crash with multi-statement closure inference
enabled in result builder contexts.
2021-12-26 21:16:27 -08:00
Saleem Abdulrasool
d1bb98b11e Merge pull request #40625 from buttaface/droid-remove-icu
[android] Remove ICU build flags since that requirement was dropped in #40340
2021-12-23 09:31:05 -06:00
Alejandro Alonso
27ec10e8da Merge pull request #40181 from Azoy/testing-unicode-scalar-props
[test][stdlib] Beef up Unicode.Scalar.Properties testing
2021-12-21 23:06:41 -08:00
Kuba (Brecka) Mracek
663a6fb771 Introduce SWIFT_STDLIB_HAS_TYPE_PRINTING flag to remove the ability to print types at runtime (to save codesize) (#40649) 2021-12-21 17:47:54 -08:00
Alejandro Alonso
12d2e8f72d Mark UnicodeScalarProperties Darwin only for right now 2021-12-21 02:13:56 -08:00
Alejandro Alonso
edc5d88d17 Test the rest of the scalar properties
oops forgot to put this back in and 5.6
2021-12-20 15:15:07 -08:00