Commit Graph

519 Commits

Author SHA1 Message Date
Hamish Knight
14608cb059 [Sema] Skip type-checking catch bodies when computing the bound error type
Make sure we only ever type-check the `do` body of a `do-catch`
statement when lazily type-checking the bound error type, which we can
do for completion.

rdar://164481242
2025-11-11 23:04:30 +00: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
f205f469a9 [CS] Replace error type with hole for projected value
Missed this in my previous patch, make sure we replace an error with
a hole if necessary.
2025-11-05 20:29:15 +00: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
f67c54d24c [test] Update a couple of crasher signatures 2025-10-27 08:49:51 +00:00
Hamish Knight
62f0926d25 [CS] Invalidate nested unresolved VarDecls when ignoring completion argument
Make sure we set types for any nested VarDecls in UnresolvedPatternExprs
to ensure we don't crash when attempting to solve the body.
2025-10-26 12:33:29 +00:00
Hamish Knight
c7e9809480 [IDE] Mangle USRs using API decls rather than ABI decls
For semantic functionality the API decl is the more useful thing to
mangle, and redeclaration checking ensures we can't end up with
conflicts. This ensures we're able to perform a name lookup for the
decl based on its USR without having to maintain a separate lookup 
table for ABI names.
2025-10-23 09:11:17 +01: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
Hamish Knight
ffd3a4849c [test] Include signatures in crasher filenames 2025-10-17 20:22:28 +01:00
Hamish Knight
b14dc227f7 Merge pull request #84855 from hamishknight/loc-ness-monster
[Parse] Avoid setting closure `in` SourceLoc if missing
2025-10-14 09:16:12 +01:00
Hamish Knight
b83cf1eaa5 [Parse] Avoid setting closure in SourceLoc if missing
Clients should be able to handle closures without a valid `in`
SourceLoc, let's avoid setting it to a recovery location. This avoids
crashing in cases where we set an `in` loc that's after the closure's
end loc.
2025-10-13 15:34:57 +01:00
Hamish Knight
a8be69f33b [test] Add some more known crashers 2025-10-13 10:00:10 +01:00
Hamish Knight
109383a9ac [test] Update some crasher signatures 2025-10-13 00:30:19 +01:00
Hamish Knight
74fcee3982 [test] Add some more known crashers 2025-10-06 11:50:39 +01:00
Hamish Knight
1186721fd3 [test] Update a couple of crasher signatures 2025-10-06 11:50:39 +01:00
Hamish Knight
9a9a6a3b98 Merge pull request #84694 from hamishknight/tuple-trouble
[Sema] Reject tuple extensions early when feature is disabled
2025-10-05 20:53:37 +01:00
Slava Pestov
811a201bc1 Merge pull request #84675 from slavapestov/rqm-protocol-failure-bookkeeping
RequirementMachine: New way of propagating failure when building rewrite system for protocol
2025-10-05 14:10:00 -04:00
Hamish Knight
8ec8902e56 [Sema] Reject tuple extensions early when feature is disabled
Tuple extensions are still an experimental feature, but we have a
number of crashers in the repo for them because we still use their
type-checker machinery even when disabled. Change the logic here such
that we reject them early in extension binding when the feature is
disabled. This will ensure we address the crashers before productizing.
2025-10-05 11:22:54 +01:00
Slava Pestov
244d2afea3 RequirementMachine: New way of propagating failure when building rewrite system for protocol
If we failed to construct a rewrite system for a protocol, either because
the Knuth-Bendix algorithm failed or because of a request cycle while
resolving requirements, we would end up in a situation where the resulting
rewrite system didn't include all conformance requirements and associated
types, so name lookup would find declarations whose interface types are
not valid type parameters.

Fix this by propagating failure better and just doing nothing in
getReducedTypeParameter().

Fixes rdar://147277543.
2025-10-04 09:17:46 -04:00
Hamish Knight
669a2ce9b0 [CS] Sink placeholder handling logic into Solution::simplifyType
Move the logic from `FailureDiagnostic::resolveType` into
`Solution::simplifyType` to allow completion to use it too. While
here, also handle cases where the placeholder is from a different
member of the equivalence class to the generic parameter.
2025-10-04 12:56:52 +01:00
Slava Pestov
a4625ba2cb Sema: Fix crash with invalid member reference to macro 2025-10-01 14:48:51 -04:00
Hamish Knight
d666025106 [test] Add some more known crashers 2025-09-29 12:06:28 +01:00
Hamish Knight
e64241c067 Merge pull request #84426 from hamishknight/wallsocket 2025-09-23 09:30:43 +01:00
Hamish Knight
d2ac43d99d [test] Add some more known crashers 2025-09-22 10:16:51 +01:00
Hamish Knight
0bfbe987b4 [AST] Print ErrorType as _
In preparation for removing UnresolvedType in favor of ErrorType,
start printing ErrorType as `_` unless we've enabled debug printing.
`<<error type>>` should never be presented to the user, instead `_`
now just consistently means "unknown type".
2025-09-21 23:19:06 +01:00
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