Commit Graph

489 Commits

Author SHA1 Message Date
Hamish Knight
2769b3398b [test] Update a couple of crasher signatures 2025-09-19 13:13:00 +01:00
Hamish Knight
54ff7b339c [test] Fix up crasher test names
Turns out my code for this has been wrong all this time and hasn't
been been including leading zeros for each hex byte.
2025-09-19 13:11:53 +01:00
Hamish Knight
a976af09ba [IDE] Ignore unresolved types in WithSolutionSpecificVarTypesRAII
Make sure we don't try to set an UnresolvedType as a VarDecl interface
type in WithSolutionSpecificVarTypesRAII.
2025-09-17 23:00:27 +01:00
Hamish Knight
411e14d00b Merge pull request #84275 from hamishknight/skippy
[CS] Avoid skipping SingleValueStmtExpr branch with ReturnStmt for completion
2025-09-15 09:33:17 +01:00
Hamish Knight
6de09e1956 [test] Add some more known crashers 2025-09-14 10:35:53 +01:00
Hamish Knight
adb40dd82e [test] Update a couple of crasher signatures 2025-09-14 10:35:53 +01:00
Hamish Knight
f1ad703430 [CS] Avoid skipping SingleValueStmtExpr branch with ReturnStmt for completion
We still need to solve a branch with a ReturnStmt to avoid leaving
the contextual result type unbound. This isn't currently legal anyway,
so isn't likely to come up often in practice, but make sure we can
still solve.
2025-09-13 19:15:34 +01:00
Hamish Knight
014ed51ab1 Merge pull request #84220 from hamishknight/times-arrow
[AST] Allow storing original expression in `ErrorTypeRepr`
2025-09-12 17:06:34 +01:00
Hamish Knight
c84d2abb05 [AST] Allow storing original expression in ErrorTypeRepr
This is useful for ArrowExpr when the sub-expressions aren't valid
TypeExprs. Rather than throwing away the AST, attach it to the
ErrorTypeRepr to ensure we can still type-check it. This ensures
semantic functionality still works correctly, and fixes a crash where
we'd stop visiting an invalid binding pattern, losing track of the
nested VarDecl.
2025-09-11 13:21:03 +01:00
Hamish Knight
9beb2e3e36 [Completion] Simplify opened function type in tryResolveDoubleAppliedFunction 2025-09-11 10:31:46 +01: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
Hamish Knight
dcacc5917e [test] Disable USR verification for a couple of SDK completion tests
rdar://159844268
2025-09-09 17:07:04 +01: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
Ahmed Elrefaey
1bc96857a8 Merge pull request #82464 from a7medev/feat/full-documentation-in-code-completion
[IDE] Add full documentation to code completion result
2025-09-04 10:06:21 +01:00
Hamish Knight
1f0d22807c [test] Add some more known crashers 2025-09-01 09:28:55 +01:00
Hamish Knight
19b16a5b6d [test] Update a couple of crasher signatures 2025-09-01 09:28:55 +01:00
Hamish Knight
a1e4a08ac7 Merge pull request #83593 from hamishknight/disable-fallback
[IDE] Remove fallback type-checking logic
2025-08-31 10:09:22 +01:00
Hamish Knight
d7fea157a1 [IDE] Remove fallback type-checking logic
This should no longer be necessary, rip it out.
2025-08-30 14:08:42 +01:00
Hamish Knight
a9e339b973 [CS] Strengthen check for completion in CSApply
Turns out we don't always set a completion callback for some unqualified
completion positions. Upgrade the check for a completion callback to
a check for a completion buffer to account for this. This avoids
unnecessary type-checker work as well as fixing a couple of
double-type-checking crashers.
2025-08-29 16:20:06 +01:00
Hamish Knight
3d9b7f3ac2 [Completion] Avoid type-checking parent closure for unattached node
We should have already type-checked a parent closure, and we wouldn't
be able to correctly locate the node anyway since it's not actually
part of the AST. While here, also walk up to the parent-most closure
instead of recursing to avoid unnecessary stack frames for nested
closures.
2025-08-28 19:30:54 +01:00
Hamish Knight
0eae70cd84 Merge pull request #83961 from hamishknight/null-and-void
[IDE] Use `nullableTypesEqual` in `AfterPoundExprCompletion::sawSolutionImpl`
2025-08-28 13:06:53 +01:00
Hamish Knight
4aeb7e1b52 [IDE] Use nullableTypesEqual in AfterPoundExprCompletion::sawSolutionImpl
Avoid crashing if we can't compute the expected type.
2025-08-28 00:33:54 +01:00
Hamish Knight
7e22297b71 [AST] Walk ErrorExpr's original expr in ASTWalker
We set an original expression on ErrorExpr for cases where we have
something semantically invalid that doesn't fit into the AST, but is
still something that the user has explicitly written. For example
this is how we represent unresolved dots without member names (`x.`).
We still want to type-check the underlying expression though since
it can provide useful diagnostics and allows semantic functionality
such as completion and cursor info to work correctly.

rdar://130771574
2025-08-27 15:27:06 +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
Hamish Knight
8d80454591 [test] Record whether a crasher is a stack overflow 2025-08-15 17:09:58 +01:00
Hamish Knight
acf6375d46 Introduce BindExtensionsForIDEInspectionRequest
This allows us to lazily bind extensions after mutating the AST,
ensuring we don't prematurely kick the building of lookup tables.
2025-08-10 23:49:03 +01:00
Hamish Knight
0bd1ff0572 Avoid dropping ExtInfo in replaceParamErrorTypeByPlaceholder
Make sure we preserve the info to avoid hitting an assert.
2025-08-07 12:17:03 +01: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
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
aac9c4dec6 [test] Add timeout for fd52bd37cd5c96.swift
Make sure we either crash or timeout after a minute.
2025-07-30 15:13:50 +01:00
Hamish Knight
ae0f9f51d8 [test] Add some more known crashers 2025-07-28 11:14:13 +01:00
Hamish Knight
860f398162 Merge pull request #83198 from hamishknight/fuzzy
[test] Add some more known crashers
2025-07-22 18:50:30 +01:00
Hamish Knight
cb0a21da2a Merge pull request #83170 from hamishknight/fix-assert
[IDE] Fix assertion failure in `PostfixCompletionCallback::Result::tryMerge`
2025-07-21 18:48:03 +01:00
Hamish Knight
994b9d197b [test] Add some more known crashers 2025-07-21 10:47:59 +01:00
Hamish Knight
347d94bda5 [test] Add some alias crash signatures
The signatures here are bogus, put the correct signatures in as
aliases.
2025-07-20 18:46:18 +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
Hamish Knight
62f1303bca [IDE] Fix assertion failure in PostfixCompletionCallback::Result::tryMerge
Unfortunately due to pre-checking multiple times the recorded
application level can change. Just OR the bits together.
2025-07-18 11:00:37 +01:00
Hamish Knight
72db18073c [Sema] Set ReturnStmt result even if type-checking fails
Make sure we set the updated expression since e.g pre-checking may
have folded a top-level SequenceExpr that we need to remove from the
AST.
2025-07-16 14:40:57 +01: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
7508cb7d3b [test] Add some more known crashers 2025-07-14 19:56:51 +01:00
Hamish Knight
af96c9860c [Sema] Avoid folding sequences multiple times for completion
Completion can end up calling into pre-checking multiple times in
certain cases, make sure we don't attempt to fold a SequenceExpr
multiple times since its original AST is in a broken state
post-folding. Instead, just return the already-folded expression.

rdar://133717866
2025-07-14 17:30:02 +01:00
Hamish Knight
3f74263ab4 Merge pull request #82910 from hamishknight/unbounded 2025-07-10 08:42:55 +01:00
Hamish Knight
adbbb9e3cd [IDE] Fix sort predicate in printCodeCompletionLookedupTypeNames
This wasn't a strict weak ordering, and it turns out violating that
is undefined behavior which can result in buffer overruns.
2025-07-09 19:50:43 +01:00
Hamish Knight
e631a37d0b [Completion] Avoid using unbound contextual type in argument completion
Match the logic in `getTypeForCompletion` and avoid using an unbound
generic type as the expected type for a completion.

rdar://155420395
2025-07-09 12:57:36 +01:00
Hamish Knight
3ab8fb7053 [test] Tweak a couple of crasher test cases
- Make `539adae64314fae.swift` macOS-only and use guard malloc for it.
- Tweak `1e4b431ffe374ef1.swift` such that it succeeds if it either
times out after a minute or crashes. While here, also clean up the
test case a little.
2025-07-09 12:14:02 +01:00
Hamish Knight
5cbdcaf655 Merge pull request #82834 from hamishknight/fuzzy
[test] Add some more known crashers
2025-07-08 08:32:52 +01:00