Commit Graph

7754 Commits

Author SHA1 Message Date
Hamish Knight
9a0a831b01 Merge pull request #82147 from hamishknight/fix-nested-arenas
[CS] Avoid solver-allocated inputs with `typesSatisfyConstraint`
2025-06-13 16:53:51 +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
Hamish Knight
6d0da8d5cc [CS] Avoid solver-allocated inputs with typesSatisfyConstraint
Escaping solver-allocated types into a nested allocation arena is
problematic since we can e.g lazily compute the `ContextSubMap` for a
`NominalOrBoundGenericNominalType`, which is then destroyed when we
exit the nested arena. Ensure we don't pass any types with type
variables or placeholders to `typesSatisfyConstraint`.

rdar://152763265
2025-06-12 12:11:19 +01:00
Meghana Gupta
8396a6d8c0 Fix an inliner crash when inlining begin_apply with scoped lifetime dependence
LifetimeDependenceInsertion inserts mark_dependence on token result of a begin_apply
when it yields a lifetime dependent value. When such a begin_apply gets inlined,
the inliner can crash because of the remaining uses of the token result.

Fix this by inserting mark_dependence on parameter operands that are lifetime dependence sources
and deleting the mark_dependence on token results in the inliner.

Fixes rdar://151568816
2025-06-12 01:35:36 -07:00
Eric Miotto
b7f8eb7480 build-script: Remove support for legacy way of building compiler-rt
Addresses rdar://149293315
2025-06-11 14:39:05 -07:00
Hamish Knight
580f20efec Merge pull request #82150 from hamishknight/fixed-test
[test] Mark `8c2d6198e18a56a.swift` as fixed
2025-06-11 11:13:09 +01:00
Slava Pestov
5cdc9a6570 AST: More robust TypeBase::getSuperclassForDecl()
This can return ErrorType if the AST is invalid.

A handful of callers handle the ErrorType result, but most don't,
blindly assuming the result is always a nominal type. This resulted
in a crash in at least one test case.

Lift the burden from callers by always returning a nominal type here.
2025-06-10 16:49:57 -04:00
Slava Pestov
3796b327a5 AST: Relax assertion in getContextSubstitutionMap() 2025-06-10 16:49:57 -04:00
Hamish Knight
bfabcf1ae5 [test] Mark 8c2d6198e18a56a.swift as fixed 2025-06-10 16:23:52 +01:00
Hamish Knight
ba715db935 Merge pull request #82103 from hamishknight/fuzzy
[test] Add a few more known type-checker crashers
2025-06-10 12:29:39 +01:00
Meghana Gupta
7d454533a0 Merge pull request #82067 from meg-gupta/lifetimeunderscored
Update spelling for representing lifetime dependencies to @_lifetime
2025-06-09 19:01:31 -07:00
Hamish Knight
92a5c00726 [test] Add a few more known type-checker crashers 2025-06-09 20:03:28 +01:00
Hamish Knight
d3abee7e96 [test] Require asserts for all compiler_crashers_2 tests
These contain a mix of crashers that may or may not crash under
non-asserts builds, avoid testing them for non-asserts builds. When
fixed, they'll receive non-assert coverage.
2025-06-09 12:40:34 +01:00
Daniel Rodríguez Troitiño
80e06b6100 [test] Compiler crasher only seem to happen in asserts mode (#82095)
6a33401772c7458.swift doesn't seem to crash in non-asserts mode, so mark
is as requiring asserts so it does not fail when building for
non-asserts.
2025-06-08 19:06:15 -07:00
Meghana Gupta
44e05fa858 [NFC] Update tests and diagnostics 2025-06-07 12:49:01 -07:00
Hamish Knight
eca93d6f90 [test] Disable 7cee1719e3503ef6.swift for now
This is crashing non-deterministically.
2025-06-07 10:44:56 +01:00
Anthony Latsis
d10dfb3ae9 Merge pull request #82020 from AnthonyLatsis/camellia-sinensis
Sema: Never record argument label mismatches for unlabeled trailing closures
2025-06-07 01:29:54 +01:00
Hamish Knight
1979c78b06 Merge pull request #82059 from hamishknight/fuzzy
[test] Add a few more known type-checker crashers
2025-06-06 19:47:53 +01:00
nate-chandler
17798c781f Merge pull request #82043 from nate-chandler/rdar152580661
[TypeLowering] Record pack used in aggregate signature.
2025-06-06 11:37:24 -07:00
Artem Chikin
10cd7baef0 [Legacy Driver] Obsolete and remove batch compilation mode from the legacy driver
It is a maintenance burden and having the legacy driver exist in a simplified state reduces the possibility of things going wrong and hitting old bugs.
2025-06-06 09:51:00 -07:00
Hamish Knight
c4e88f5f43 [test] Add a few more known type-checker crashers 2025-06-06 10:57:53 +01:00
Nate Chandler
dfcb5ee147 [TypeLowering] Record pack used in aggregate sig.
Every `LowerType::visit*` function eventually calls through to a
`LowerType::handle*` function.  After
https://github.com/swiftlang/swift/pull/81581, every
`LowerType::handle*` needs to set the `hasPack` flag based on the
passed-in type by calling `mergeHasPack`.  Add the missing call in the
`handleAggregateByProperties` function.

rdar://152580661
2025-06-05 17:33:59 -07:00
Anthony Latsis
f2e1420a90 Sema: Never record argument label mismatches for unlabeled trailing closures
Fixes a crash on invalid. The previous logic was causing a label
mismatch constraint fix to be recorded for an unlabeled trailing closure
argument matching a variadic paramater after a late recovery argument
claim in `matchCallArgumentsImpl`, because the recovery claiming skips
arguments matching defaulted parameters, but not variadic ones. We may
want to reconsider that last part, but currently it regresses the
quality of some diagnostics, and this is a targeted fix.

The previous behavior is fine because the diagnosis routine associate
with the constraint fix (`diagnoseArgumentLabelError`) skips unlabeled
trailing closures when tallying labeling issues — *unless* there are no
other issues and the tally is zero, which we assert it is not.

Fixes rdar://152313388.
2025-06-05 18:01:20 +01:00
Slava Pestov
0bdee282aa This test needs asserts
Fixes rdar://152543008.
2025-06-04 11:05:43 -04:00
Slava Pestov
c61a4fe333 Merge pull request #81949 from slavapestov/missing-part-of-se-0346
Sema: Implement missing part of SE-0346
2025-06-04 09:24:19 -04:00
Slava Pestov
cd5ecbee16 Sema: Implement missing part of SE-0346
The proposal states that this should work, but this was never
implemented:

    protocol P<A> {
      associatedtype A
    }

    struct S: P<Int> {}

- Fixes https://github.com/swiftlang/swift/issues/62906.
- Fixes rdar://91842338.
2025-06-03 17:28:19 -04:00
Slava Pestov
e69a59bad0 Merge pull request #81925 from slavapestov/test-rdar151466803
Add regression test for fixed crasher
2025-06-03 16:23:48 -04:00
Pavel Yaskevich
b189b8a320 Merge pull request #81936 from xedin/improve-optional-wrappedValue-mismatch-diagnostics
[CSSimplify] Fix `matchDeepEqualityTypes` to allow fixing of optionals
2025-06-03 09:19:50 -07:00
Meghana Gupta
d1a97f1b0d Merge pull request #81879 from meg-gupta/fixdeserialization
Fix deserialization of lifetime dependencies on ast function types
2025-06-03 08:56:54 -07:00
Slava Pestov
6c4d040440 Merge pull request #81928 from slavapestov/test-issue-81712
Add regression test for fixed crasher
2025-06-03 04:10:10 -04:00
Pavel Yaskevich
4132aa04f9 [Tests] NFC: Update all of the test-cases improved by changes to generic argument mismatch handling 2025-06-03 00:49:06 -07:00
Slava Pestov
02ee1a317b Add regression test for fixed crasher 2025-06-02 23:24:13 -04:00
Slava Pestov
dc813a08ca Add regression test for fixed crasher 2025-06-02 22:58:29 -04:00
Meghana Gupta
36f3574f9c Fix deserialization of lifetime dependencies on ast function types
While deserializing AST function types FunctionType and GenericFunctionType which include
lifetime dependencies and an implicit self parameter, we don't correctly populate
ASTExtInfoBuilder.lifetimeDependencies.  We end up reading one dependency less due to
incorrect index calculation.

Unlike SILFunctionType, AST function types FunctionType and GenericFunctionType
do not include implicit self in their param list. They represent methods with
implicit self as like: `(Self) -> (Args...) -> Result` and don't have any information
to indicate they may have implicit self. Since we use number of parameters while
deserializing lifetime dependencies, we go wrong for such function types.

Serialize the length of parameter indices, so that lifetime dependencies can be
deserialized to that length.

rdar://151768216
2025-06-02 17:29:05 -07:00
Slava Pestov
66177e9b9a These tests require asserts 2025-06-02 13:15:01 -04:00
Hamish Knight
59588bc105 [test] Add a few more known type-checker crashers 2025-06-01 17:20:26 +01:00
Slava Pestov
f6f0d75263 Merge pull request #81843 from slavapestov/hamish-fuzzer-fixes
Hamish fuzzer fixes
2025-05-31 12:28:56 -04:00
Hamish Knight
ea63d04b6c Merge pull request #81866 from hamishknight/fuzzy
[test] Add a couple more known test-checker crashers
2025-05-31 00:15:38 +01:00
Slava Pestov
4e6352d5d9 Sema: Handle bogus DeclNameRefs in translateExprToDeclRefTypeRepr() 2025-05-30 16:27:01 -04:00
Slava Pestov
a3444a0c87 Sema: Handle invalid conformance in ApplyClassifier::classifyApply() 2025-05-30 16:27:01 -04:00
Slava Pestov
d3cf1a42b9 Sema: getBaseIdentifier() => isSimpleName() in synthesizeCodingKeysIfNeededForUnqualifiedLookup() 2025-05-30 16:27:01 -04:00
Slava Pestov
401f527bbb Sema: Don't construct TupleType with InOutType inside 2025-05-30 16:27:01 -04:00
Slava Pestov
6d0c73935b Parse: An empty escaped identifier is entirely whitespace 2025-05-30 16:27:00 -04:00
Slava Pestov
ff941bc4f3 Sema: Fix crash when any is followed by something that doesn't parse as a type 2025-05-30 14:44:58 -04:00
Slava Pestov
0a0019ba76 Sema: Fix null pointer dereference with invalid ParamDecl 2025-05-30 14:44:24 -04:00
Slava Pestov
0e1561f05a Sema: Change a couple of Identifier usages to DeclName instead 2025-05-30 14:43:48 -04:00
Pavel Yaskevich
f31cdb3fec Merge pull request #81852 from xedin/rdar-151943924
[TypeCheckEffects] Fix `AbstractFunction::getType` to look through al…
2025-05-30 11:03:40 -07:00
Hamish Knight
c81f0a868e [test] Add a couple more known test-checker crashers 2025-05-30 16:27:32 +01:00
Pavel Yaskevich
86390ab91f [TypeCheckEffects] Fix AbstractFunction::getType to look through all levels of optional
A member and a parameter could be wrapped in an arbitrary number
of `Optional`, we need to look through all of them to get to the
underlying function type.

Resolves: rdar://151943924
2025-05-29 13:49:15 -07:00
Hamish Knight
b7d26fdfde [test] Add some known type-checker + parser crashers 2025-05-29 16:23:50 +01:00