Commit Graph

479 Commits

Author SHA1 Message Date
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
Hamish Knight
8b3cb86d7f Merge pull request #82802 from hamishknight/context-fail
[Completion] Map failable initializer result type into context
2025-07-08 06:20:17 +01:00
Hamish Knight
5730eb2e10 [test] Add some more known crashers 2025-07-07 11:12:36 +01:00
Hamish Knight
3a8bf75951 Merge pull request #82761 from hamishknight/req-assert
[test] Require asserts for IDE crashers
2025-07-04 14:10:10 +01:00
Hamish Knight
e7bf62dd81 [Completion] Map failable initializer result type into context
Make sure we don't pass an interface type to `setTypeContext`.

rdar://155038769
2025-07-04 13:55:40 +01:00
Hamish Knight
d6037049b1 [CS] Ensure type variables are eliminated by Solution::simplifyType
`TypeSimplifier` may not eliminate type variables from e.g the
pattern types of pattern expansion types since they can remain
unresolved due to e.g having a placeholder count type. Make sure we
eliminate any remaining type variables along with the placeholders.
There's probably a more principled fix here, but this is a quick and
low risk fix we can hopefully take for 6.2.

rdar://154954995
2025-07-03 16:24:31 +01:00
Hamish Knight
4aee90318a [test] Require asserts for IDE crashers 2025-07-03 10:53:27 +01:00
Hamish Knight
3daae5955e [AST] Use ErrorType for invalid value generic parameter
If we fail to resolve the value type for a value generic parameter,
previously we would have returned a null Type, causing crashes
downstream. Instead, return an ErrorType, leaving a null Type for
cases where the generic parameter isn't a value generic at all.

rdar://154856417
2025-07-02 14:46:55 +01:00
Hamish Knight
beb2b58d62 [test] Mark a couple of IDE crashers as fixed (#82685)
Seems like these may have been fixed by #82574, unfortunately there was
a race with #82619
2025-07-01 11:00:29 -07:00
Hamish Knight
b9afc87c28 [test] Add some more known crashers 2025-06-30 20:52:06 +01:00
Hamish Knight
db49faf167 [Sema] Avoid solver-allocated original ErrorTypes in transformDependentMemberType
`substBase` here can contain type variables or placeholders, avoid
using them as the original ErrorTypes since ErrorTypes cannot be
solver-allocated currently. This only affects type printing so
shouldn't matter much.
2025-06-12 17:54:59 +01:00