Commit Graph

241 Commits

Author SHA1 Message Date
John McCall
e5b6a88c5e Merge pull request #84181 from rjmccall/isolation-fixes
Isolation fixes for closures and defer bodies
2025-09-10 08:39:09 -04:00
Hamish Knight
872176bdd1 Merge pull request #84149 from hamishknight/case-and-pat
A few pattern cleanups + fixes
2025-09-10 09:36:22 +01:00
Slava Pestov
0063c3c522 Merge pull request #84131 from slavapestov/remove-covariant-result-type-post-cleanup
Sema: Clean up getTypeOfMemberReference() and buildMemberRef()
2025-09-10 01:39:38 -04:00
Slava Pestov
68be47f166 Sema: Re-organize some logic in getTypeOfMemberReference() 2025-09-09 18:58:10 -04:00
Slava Pestov
13b4b03aca Sema: Fix crash in IgnoreAssignmentDestinationType::diagnoseForAmbiguity() 2025-09-09 18:58:10 -04:00
John McCall
3088b85c2c Don't crash if there's a request cycle with DefaultArgumentExprRequest. 2025-09-09 14:26:57 -04:00
Hamish Knight
9db82cbe62 [AST] Avoid walking a few more expressions in WalkToVarDecls
Avoid walking TapExprs, SingleValueStmtExprs, and key paths. The latter
is important since they can contain invalid VarDecls that will no
longer be visited by the ASTWalker after key path resolution, so we
don't want to create case body vars for them.
2025-09-09 13:48:40 +01:00
Allan Shortlidge
c931935aa2 Test: Fix availability in a79aa9924bdc378.swift. 2025-09-08 19:20:17 -07:00
Hamish Knight
a2f7d239ab [test] Add some more known crashers 2025-09-08 08:16:31 +01:00
Hamish Knight
7fb532e4e6 Merge pull request #83776 from hamishknight/the-diags-never-stop-no
[Diags] Allow multiple in-flight diagnostics
2025-09-03 19:59:44 +01:00
Hamish Knight
1f0d22807c [test] Add some more known crashers 2025-09-01 09:28:55 +01:00
Hamish Knight
1b0eed22be [CS] Better propagate holes from contextual types
Eagerly bind invalid type references to holes and propagate contextual
type holes in `repairFailures`. This avoids some unnecessary diagnostics
in cases where we have an invalid contextual type.
2025-08-29 15:04:20 +01:00
Hamish Knight
a309fc0ac9 Merge pull request #83992 from hamishknight/tweak-assert 2025-08-29 06:08:57 +01:00
Slava Pestov
4f6d7f40ec Merge pull request #83986 from slavapestov/fix-rdar158774099
AST: Remove old hack that appears to be obsolete and revert a revert of another fix
2025-08-28 23:59:46 -04:00
Hamish Knight
627f41ccbc [CS] Fix an overly strict assert
`matchExistentialTypes` can handle existential metatypes, fix the
assert to handle that.
2025-08-29 00:17:14 +01:00
Slava Pestov
672135b053 AST: Remove old hack that appears to be obsolete
The FIXME was originally introduced in 2017 by commit c0805a2bc8.

Good riddance!
2025-08-28 16:51:49 -04:00
Hamish Knight
79e8a6cb3c [Sema] Avoid marking TypeRepr invalid with SilenceErrors
Pattern resolution currently invokes type resolution with this flag
since it's trying to see if it can treat a given expression as a
TypeRepr for e.g an enum pattern. Make sure we don't `setInvalid` on
such TypeRepr nodes since that will avoid diagnosing in cases where
the node also then gets treated as a TypeRepr for an ExprPattern,
where we actually want the diagnostic emitted.
2025-08-28 15:31:48 +01:00
Hamish Knight
0c16c00bb4 [Sema] Resolve interface type in ExtendedTypeRequest
Resolving only a structural type meant we weren't checking generic
constraints, allowing invalid extensions to get past the type-checker.
Change to resolve an interface type.
2025-08-24 11:49:14 +01:00
Hamish Knight
0c29284098 [test] Add some more known crashers 2025-08-22 00:54:18 +01:00
Hamish Knight
8c6a1f8878 [test] Update a couple of crasher signatures 2025-08-21 09:46:53 +01:00
Pavel Yaskevich
a5649a12e5 Merge pull request #83735 from xedin/rdar-158159462
[CSOptimizer] Add support for opened existential arguments
2025-08-18 00:16:24 -07:00
Hamish Knight
45065f3069 [Diags] Allow multiple in-flight diagnostics
Lift the limitation of a single active diagnostic, which was a pretty
easy-to-hit footgun. We now maintain an array of active in-flight
diagnostics, which gets flushed once all them have ended.
2025-08-17 11:48:21 +01:00
Hamish Knight
89787e24b6 Merge pull request #83766 from hamishknight/fifty-thousand-ants
[CS] Use apply component locator for `verifyThatArgumentIsHashable`
2025-08-16 05:20:51 +01:00
Hamish Knight
4423399fce [CS] Use apply component locator for verifyThatArgumentIsHashable
For a method key path use the locator for the apply itself rather
than the member, ensuring we handle invalid cases where the apply is
the first component, and providing more accurate location info.
2025-08-15 21:30:22 +01:00
Hamish Knight
8d80454591 [test] Record whether a crasher is a stack overflow 2025-08-15 17:09:58 +01:00
Pavel Yaskevich
0d33af78ca [CSOptimizer] Add support for opened existential arguments
Check whether it would be possible to match a parameter type
by opening an existential type of the candidate argument.

Resolves: rdar://158159462
2025-08-15 00:14:51 -07:00
Hamish Knight
e7098a34b2 [Sema] Remove isInvalid checks from checkAndContextualizePatternBindingInit
The invalid bit on PatternBindingDecl is very coarse grained, it
means any of the possible binding entries could be invalid.
Contextualization can handle invalid code anyway (e.g this is what we
do for `typeCheckBody`), so let's just avoid checking.
2025-08-11 12:55:36 +01:00
Allan Shortlidge
4d41db3b5d Sema: Rationalize availability checking in unavailable contexts.
Correct several behaviors of availability checking in unavailable contexts that
were inconsistent with the checking model:

- Avoid diagnosing unintroduced and obsolted declarations in contexts that are
  unavailable in the same domain.
- Diagnose unavailability normally in type signature contexts.
2025-08-08 07:57:44 -07:00
Hamish Knight
3db1a66f08 Merge pull request #83514 from hamishknight/add-assert-msgs
[test] Add assertion messages to crasher test cases
2025-08-04 23:05:32 +01:00
Pavel Yaskevich
7d75f712b6 Merge pull request #83511 from xedin/rdar-152553143
[CSSyntacticElement] Remove an assert that is too strict
2025-08-04 14:09:09 -07:00
Hamish Knight
760959f273 [test] Add assertion messages to crasher test cases
If the crasher hits an assertion failure, include the message in the
header.
2025-08-04 13:00:23 +01:00
Pavel Yaskevich
3879a47b52 [CSSyntacticElement] Remove an assert that is too strict
`return` statement withot an expression automatically gets an
implicit `()` which is allowed to be converted to types like
`()?` and `Any` or `Any?`. Let's remove a too strict assertion
that expected a contextual type to always be `()?` even
through in reality any type that `()` is convertible to is valid.

Resolves: rdar://152553143
2025-08-04 00:17:26 -07:00
Hamish Knight
cfa8135261 [test] Add some more known crashers 2025-08-04 00:44:41 +01:00
Hamish Knight
a012464566 [test] Update some crasher signatures 2025-08-02 17:35:53 +01:00
Hamish Knight
fb7f2d0ff2 [CS] Limit the number of chained @dynamicMemberLookup lookups
Set an upper bound on the number of chained lookups we attempt to
avoid spinning while trying to recursively apply the same dynamic
member lookup to itself.

rdar://157288911
2025-08-01 19:08:04 +01:00
Hamish Knight
ae0f9f51d8 [test] Add some more known crashers 2025-07-28 11:14:13 +01:00
Hamish Knight
74601b5e58 [test] Remove duplicate test case
This is essentially the same as `4414db6acd8120aa.swift`.
2025-07-28 11:14:13 +01:00
Hamish Knight
d7c30cd965 [test] Update a couple of crasher signatures 2025-07-28 11:14:13 +01:00
Slava Pestov
5866d8a36a Sema: Fix crash with invalid reference to macro 2025-07-24 12:55:47 -04:00
Pavel Yaskevich
3b06d87e90 Merge pull request #83179 from xedin/rdar-128109889
[ASTVerifier] Allow `inout` and `Array` to pointer conversion in vari…
2025-07-23 07:48:58 -07:00
Hamish Knight
994b9d197b [test] Add some more known crashers 2025-07-21 10:47:59 +01:00
Hamish Knight
03f74ff394 [test] Update a couple of crasher signatures 2025-07-21 10:47:59 +01:00
Hamish Knight
a2d707be2a [test] Remove duplicate test case
This is essentially the same as `8668a3eb11f2baf.swift`.
2025-07-20 18:32:45 +01:00
Hamish Knight
7e22f9264b [test] Update some crasher signatures
The signatures have changed here either due to code changes in the
repo or due to improvements to the signature detection, update the
test cases.
2025-07-20 18:32:38 +01:00
Pavel Yaskevich
b5aa8173ce [ASTVerifier] Allow inout and Array to pointer conversion in variadic parameter positions
Fixes a verifier crash that prevented use of valid conversions.

Resolves: https://github.com/apple/swift/issues/73454
Resolves: rdar://128109889
2025-07-18 11:35:21 -07:00
Slava Pestov
ee440f3c91 AST: Remove MakeAbstractConformanceForGenericType
While the intent behind this functor was noble, it has grown in complexity
considerably over the years, and it seems to be nothing but a source of
crashes in practice. I don't want to deal with it anymore, so I've decided
to just subsume all usages with LookUpConformanceInModule instead.
2025-07-15 16:34:11 -04:00
Hamish Knight
818979fed8 Merge pull request #83034 from hamishknight/origami
[Sema] Avoid folding sequences multiple times
2025-07-15 09:14:55 +01:00
Hamish Knight
95a96f5593 Merge pull request #83026 from hamishknight/fuzzy 2025-07-15 03:54:25 +01:00
Hamish Knight
7508cb7d3b [test] Add some more known crashers 2025-07-14 19:56:51 +01:00
Hamish Knight
95f1b07e87 [Sema] Remove completion assert in foldSequence for now
Turns out we can also hit this case for some pattern type-checking
cases. I'll fix those in a follow-up and reinstate the assertion.
2025-07-14 18:50:42 +01:00