Commit Graph

1594 Commits

Author SHA1 Message Date
Pavel Yaskevich
4d8d719b92 Merge pull request #85406 from naveen-seth/fix-ambiguous-trailing-closure-init
[Sema] Fix crash when diagnosing ambiguous trailing closure inits
2025-11-12 10:03:46 -08:00
naveen-seth
d07ea18b55 Mark validation test as fixed 2025-11-11 00:43:01 +01:00
Hamish Knight
1b5e1db05d [test] Add some more known crashers 2025-11-10 10:40:35 +00:00
Hamish Knight
ebd97bb3a0 [test] Update a couple of crasher signatures 2025-11-10 10:40:35 +00:00
Hamish Knight
b26b0b783e [CS] Add null check for ParameterList in findFavoredChoicesBasedOnArity
rdar://164116965
2025-11-07 22:17:33 +00:00
Hamish Knight
260d10f6b8 [CS] Fix a couple of fixPropertyWrapperFailure crashers
Make sure we query the constraint system for a type if we have a local
property wrapper in a closure to avoid kicking interface type
computation outside the closure, and make sure we map into context if
we need to.
2025-11-04 00:56:01 +00:00
Hamish Knight
e0de61caa4 Merge pull request #85135 from hamishknight/lazy-fix
[AST] Avoid exposing `lazy` local storage var to name lookup
2025-11-04 00:53:31 +00:00
Kathy Gray
d68a7a7ef0 Requirement Machine: Fix an issue with pack expansion + tuple type crashes
Support pack expansion types in term rewriting, maintaining shape invariants and not
throwing assertions unnecessarily.

Additional tests added for an inifinite case and a concrete case.
2025-10-31 17:53:59 +00:00
Hamish Knight
949bb3db9b Merge pull request #85173 from hamishknight/no-asan
[test] Avoid running crasher test cases on ASan
2025-10-28 21:28:00 +00:00
Konrad `ktoso` Malawski
fc168a0773 [Distributed] Don't crash when 'open' distributed actor is declared (#85170) 2025-10-28 23:30:06 +09:00
Hamish Knight
29e1fddaa9 [test] Avoid running crasher test cases on ASan 2025-10-28 11:34:19 +00:00
Hamish Knight
41acdebce4 Merge pull request #85150 from hamishknight/fuzzy
[test] Add some more known crashers
2025-10-27 17:51:25 +00:00
Hamish Knight
88091da974 [test] Add some more known crashers 2025-10-27 08:49:51 +00:00
Hamish Knight
05e3d15955 [CS] Propagate CSApply failures in a few more places
We had some cases where we weren't propagating failures to apply the
solution, and as such weren't invalidating the resulting AST. Fix up
these cases.
2025-10-26 14:49:17 +00:00
Hamish Knight
55ebd0774e [AST] Avoid exposing lazy local storage var to name lookup
We already reject attempts to reference this for `lazy` properties.
For `lazy` locals let's just not expose it to name lookup to begin
with. This ensures we don't attempt to prematurely kick the interface
type computation for the var, fixing a couple of crashers.
2025-10-25 15:07:11 +01:00
Slava Pestov
69c8d15570 Sema: Fix a fuzzer crash
This test case crashes when prepared overloads are disabled, but passes
when enabled. To avoid messing up tests if we have to turn the flag on
and off, fix the crash.
2025-10-24 16:20:21 -04:00
Hamish Knight
0eb83fea8b [test] Add some more known crashers 2025-10-20 10:14:32 +01:00
Hamish Knight
eb9ae7c2ef [test] Update a couple of crasher signatures 2025-10-20 10:14:32 +01:00
Hamish Knight
4e811c3a88 [test] Merge crasher directories
There is no longer much of a good reason to keep these separate,
merge them.
2025-10-18 12:51:30 +01:00
Doug Gregor
c142205a50 Resolve an old compiler crasher via the new diagnostic formatter
The old diagnostic formatter would crash on some Fix-Its involving
Unicode characters. The new one does not.
2024-02-19 02:48:37 -10:00
Erik Eckstein
dccaa8f01f diagnose duplicated @_cdecl and @_silgen_name function names
Prints a regular error instead of crashing.
The check is done in SILGen, because it's simple. We could also do it earlier, but I don't see a strong reason for this.

rdar://75950093
2021-03-31 13:30:22 +02:00
Anthony Latsis
2133fe27df Sema: Have TypeResolution accept an unbound generic type opener function 2020-07-08 13:39:34 +03:00
Slava Pestov
31a78590a8 ASTMangler: Fix assertion when mangling invalid identifiers
We sometimes need to mangle invalid identifiers, for example when sorting
declarations in EmittedMembersRequest. Make sure this doesn't assert.
2020-06-29 22:17:56 -04:00
Doug Gregor
2f97d24969 Note a fixed compiler crasher 2020-06-04 23:19:47 -07:00
Slava Pestov
c543838854 Sema: Rewrite partial applications into closures
When a method is called with fewer than two parameter lists,
transform it into a fully-applied call by wrapping it in a
closure.

Eg,

Foo.bar => { self in { args... self.bar(args...) } }
foo.bar => { self in { args... self.bar(args...) } }(self)

super.bar => { args... in super.bar(args...) }

With this change, SILGen only ever sees fully-applied calls,
which will allow ripping out some code.

This new way of doing curry thunks fixes a long-standing bug
where unbound references to protocol methods did not work.

This is because such a reference must open the existential
*inside* the closure, after 'self' has been applied, whereas
the old SILGen implementation of curry thunks really wanted
the type of the method reference to match the opened type of
the method.

A follow-up cleanup will remove the SILGen curry thunk
implementation.

Fixes rdar://21289579 and https://bugs.swift.org/browse/SR-75.
2020-03-18 09:29:22 -04:00
Luciano Almeida
7557f29a27 Reverting file location 2019-06-26 17:49:47 -03:00
Luciano Almeida
6331e9a1cd Reverting file location 2019-06-26 17:49:23 -03:00
Luciano Almeida
2ef18488d6 Walking through the expr to set the types and type variables in the constraint system before add convertion constraint 2019-05-27 22:57:56 -03:00
Alexis Laferrière
bddb40dacf GSB: ignore generic types in expandConformanceRequirement
Fixes crashes in 28437-swift-typechecker-validatedecl.swift (from previous commit)
and the compiler crasher 28861-gpdecl-getdepth-generictypeparamdecl-
invaliddepth-parameter-hasnt-been-validated.swift.
2019-04-30 10:43:23 -07:00
Saleem Abdulrasool
149f6b6b81 test: disable test for incorrect behaviour
This test is testing that the verifier aborts on invalid input.
SR-10459
2019-04-11 18:54:02 -07:00
Stephen Canon
28962b5754 Move most of the simd operators into an optional module (#20914)
* Move most of the simd operators into an optional module

Adding simd to the stdlib caused some typechecker regressions. We can resolve them in the near-term by making the types universally available, but moving the arithmetic operators into a separate module that must be explicitly imported.

* Move two fuzzing tests back to fixed.

* Add SIMDOperators as a dependency for MediaPlayer.

* Move the .-prefixed operator declarations back into the stdlib.
2018-11-30 16:30:15 -05:00
Stephen Canon
fb8b9e143d SIMD into stdlib
Implements SE-0229.

Also updates simd module types in the Apple SDKs to use the new types, and updates a couple tests to work with the new types and protocols.
2018-11-29 17:09:01 -05:00
Doug Gregor
de18384d89 [AST] Don’t deserialize members of @objc protocol looking for associated types
Thanks to @slavapestov for pointing this out! The optimization to avoid
looking through the members of a protocol that can’t possibly have any
associated types was for both deserialized protocols and imported
protocols, but I only supported the former in my previous change. Check
both cases and make the reasons much more obvious.

Also, that change resolved an existing compiler crasher as well.
2018-10-06 22:08:45 -07:00
Huon Wilson
ea1560f43b [AST] Member lookup in the GSB needs to understand equivalence classes with concrete types.
A constraint like `Parameter == SomethingConcrete` means references to
`Parameter` in that context behave like `SomethingConcrete`, including for name
resolution. Handling the parameter as just a parameter type means that it won't
find any non-protocol nested types (i.e. things other than associated types and
protocol typealiases are invisible).

Fixes rdar://problem/42136457 and SR-8240.
2018-07-17 22:54:22 +10:00
Slava Pestov
d4782b0fab Sema: Another validateDeclForNameLookup() state transition bug 2018-07-10 17:01:12 -07:00
Slava Pestov
8cd89bd709 Sema: Fix archetype vs interface type mixup with type in generic function 2018-07-10 17:01:12 -07:00
Slava Pestov
00b3ce18ca AST: Fix crash when doing name lookup into class with circular inheritance 2018-07-10 17:01:12 -07:00
Slava Pestov
559c0fd33d AST: Remove assertion in typo correction
CSDiag can try doing lookups on unbound generic types, so just remove this
assertion.
2018-07-10 17:01:12 -07:00
Slava Pestov
4878889c1e Sema: Better fix for <rdar://problem/36449760> 2018-07-10 17:01:12 -07:00
Slava Pestov
3ae11e6536 Sema: Fix a recusive validation crasher 2018-07-10 17:01:12 -07:00
Slava Pestov
ef864094b8 Sema: Fix crash when accessing nominal member of protocol 2018-07-10 17:01:12 -07:00
Slava Pestov
4fa4133134 Sema: Fix crash with UnresolvedType in coerceExistential()
Fixes <rdar://problem/34357545>.
2018-07-10 17:01:12 -07:00
Slava Pestov
381483bd74 AST: Remove Expr's LValueAccessKind 2018-07-05 23:54:13 -07:00
Doug Gregor
f4359b73f9 Merge pull request #17729 from DougGregor/minimize-override-checking
[Type checker] Minimize checking needed to compute the set of overridden declarations
2018-07-05 06:38:46 -07:00
Doug Gregor
7279eeeeac [Type checker] Perform more minimal checking in resolveOverriddenDecl().
Rather than deferring to the heavyweight validateDeclForNameLookup()
to perform the “get overridden decls” operation, perform a much more
minimal validation that only looks for exact matches when the ‘override’
modifier is present.

The more-extensive checking (e.g., that one didn’t forget an override
modifier) is only performed as part of the “full” type checking of
a declaration, which will typically only be done within the same source
file as the declaration. The intent here is to reduce the amount of
work performed to check overrides cross-file, and limit the dependencies
of the “get overridden decls” operation.
2018-07-03 17:26:38 -07:00
Slava Pestov
80232e8c49 Resolve a disabled compiler crasher fixed by my recent inheritance clause changes
Fixes <rdar://problem/38932729>.
2018-07-03 15:42:31 -07:00
John McCall
9bee3cac5a Generalize storage implementations to support generalized accessors.
The storage kind has been replaced with three separate "impl kinds",
one for each of the basic access kinds (read, write, and read/write).
This makes it far easier to mix-and-match implementations of different
accessors, as well as subtleties like implementing both a setter
and an independent read/write operation.

AccessStrategy has become a bit more explicit about how exactly the
access should be implemented.  For example, the accessor-based kinds
now carry the exact accessor intended to be used.  Also, I've shifted
responsibilities slightly between AccessStrategy and AccessSemantics
so that AccessSemantics::Ordinary can be used except in the sorts of
semantic-bypasses that accessor synthesis wants.  This requires
knowing the correct DC of the access when computing the access strategy;
the upshot is that SILGenFunction now needs a DC.

Accessor synthesis has been reworked so that only the declarations are
built immediately; body synthesis can be safely delayed out of the main
decl-checking path.  This caused a large number of ramifications,
especially for lazy properties, and greatly inflated the size of this
patch.  That is... really regrettable.  The impetus for changing this
was necessity: I needed to rework accessor synthesis to end its reliance
on distinctions like Stored vs. StoredWithTrivialAccessors, and those
fixes were exposing serious re-entrancy problems, and fixing that... well.
Breaking the fixes apart at this point would be a serious endeavor.
2018-06-30 05:19:03 -04:00
Doug Gregor
ac9b3cb936 Update a few recently-resolved crashers. 2018-06-16 08:41:00 -06:00
Doug Gregor
ebd774bcd1 [Sema] Eliminate the last use of the IterativeTypeChecker.
Implement TypeChecker::resolveInheritedProtocols() in terms of
"getInheritedType()" queries, instead.

[Sema] Put back resolveInheritedProtocols().

We're still depending on it to update state in some cases.
2018-06-14 15:29:57 -07:00
Doug Gregor
2b2e143f59 [Request-Evaluator] Introduce a request for getting an "inherited type". 2018-06-14 15:29:57 -07:00