Commit Graph

742 Commits

Author SHA1 Message Date
Nishith Shah
8e2e625543 [Diagnostics] Use imperative msg for protocol conformance & switch-case fixits
This commit changes fixit messages from a question/suggestion to an
imperative message for protocol conformances and switch-case. Addresses
https://github.com/apple/swift/issues/67510.
2023-08-13 22:34:26 -07:00
Slava Pestov
64eb9dfbd4 Merge pull request #67798 from slavapestov/fix-rdar113103854
Sema: Fix a couple of problems in checkContextualRequirements()
2023-08-09 20:12:11 -04:00
Slava Pestov
a7c276bd14 Update 0161-issue-49119.swift 2023-08-09 17:11:11 -04:00
Slava Pestov
fbd1f1acbd Sema: Fix a couple of problems in checkContextualRequirements()
The original bug was a crash-on-invalid with a missing '}', but it
actually exposed a bug with nested protocols (SE-0404) and another
long-time bug.

- Whatever we do, we should skip this for protocols because their 'Self'
  parameter is not bound from context.

- getTrailingWhereClause() is not the right proxy for "has a generic
  signature different than its parent", in particular it doesn't
  round-trip through serialization. Instead, just compare generic
  signatures for pointer equality in the early return check.

The second change is source-breaking because it was possible to
write a nested type with a `where` clause and use it contradicting
its requirements across a module boundary.

Fixes rdar://113103854.
2023-08-08 15:06:08 -04:00
Slava Pestov
4ebbb60fae Regression test for rdar://problem/113492450 2023-08-08 11:03:11 -04:00
Holly Borla
43c300408b [NFC] Update additional parameter pack tests. 2023-07-20 15:36:20 -07:00
Slava Pestov
9e73dad311 Merge pull request #67342 from slavapestov/open-type-workaround
Sema: Workaround for issue in ConstraintSystem::openType()
2023-07-19 07:49:45 -04:00
Slava Pestov
e0a1a11a6b SIL: Fix substituted function type visitor for PackExpansionType with concrete pattern type
If the pattern doesn't have any pack parameters in it anymore,
we need to recover the substituted count type from the original
count type.

Fixes rdar://problem/112065340.
2023-07-18 12:19:22 -04:00
Slava Pestov
415b70584a Sema: Workaround for issue in ConstraintSystem::openType() 2023-07-17 15:33:34 -04:00
Slava Pestov
e6253b282a AST: Re-implement mapPackTypeIntoElementContext() in terms of mapContextualPackTypeIntoElementContext() 2023-07-12 18:02:14 -04:00
Slava Pestov
e01822ca20 Add regression test for rdar://problem/108319167 2023-07-03 18:41:44 -04:00
Slava Pestov
7cc8063889 SIL: Forgot to pass SubstFlags::PreservePackExpansionLevel in one place 2023-06-07 15:17:54 -04:00
Pavel Yaskevich
697dfbae96 [TypeChecker] Enable result builder AST transform by default 2022-12-21 10:31:30 -08:00
Luciano Almeida
0db4b43f6d Merge pull request #61863 from LucianoPAlmeida/crash-dump-parse-init
[ASTDumper] Special handling for init kind in pre-typecheck dump
2022-12-16 09:42:31 -03:00
Pavel Yaskevich
65e7eec62f [CSSolver] Solve multi-statement closures in source order
Currently solver picks the first conjunction it can find,
which means - the earliest resolved closure. This is not
always correct because when calls are chained closures
passed to the lower members could be resolved sooner
than the ones higher up but at the same time they depend
on types inferred from members higher in the chain.

Let's make sure that multi-statement closures are always
solved in order they appear in the AST to make sure that
types are available to members lower in the chain.
2022-12-12 10:57:21 -08:00
Luciano Almeida
70b884cf08 [ASTDumper] Special handling for init kind in pre-typecheck dump 2022-12-06 22:50:00 -03:00
Slava Pestov
3dc7a2decd Sema: Fix substMemberTypeWithBase() for non-generic typealias with 'where' clause
getContextSubstitutionMap() builds a substitution map for the generic signature of
the parent context, which is wrong if the typealias has its own 'where' clause.
2022-11-28 23:57:53 -05:00
Slava Pestov
abfe49fd3d Disable 0022-rdar21625478.swift entirely on noassert builds
Fixes rdar://problem/99800538.
2022-11-11 23:31:06 -05:00
Anthony Latsis
c55218d0e8 Merge pull request #61132 from AnthonyLatsis/migrate-test-suite-to-gh-issues-27
Gardening: Migrate test suite to GH issues p. 27
2022-09-28 05:10:40 +03:00
Anthony Latsis
34f78b2f8e Gardening: Migrate test suite to GH issues: validation-test/compiler_crashers_2_fixed (4/4) 2022-09-27 23:44:12 +03:00
Anthony Latsis
24ac121da1 Gardening: Migrate test suite to GH issues: validation-test/compiler_crashers_2_fixed (3/4) 2022-09-27 23:44:05 +03:00
Anthony Latsis
3304744698 Merge pull request #61130 from AnthonyLatsis/migrate-test-suite-to-gh-issues-26
Gardening: Migrate test suite to GH issues p. 26
2022-09-27 08:01:51 +03:00
Anthony Latsis
06195573f2 Gardening: Migrate test suite to GH issues: validation-test/compiler_crashers_2_fixed (2/4) 2022-09-27 03:14:58 +03:00
Anthony Latsis
2577af7967 Gardening: Migrate test suite to GH issues: validation-test/compiler_crashers_2_fixed (1/4) 2022-09-27 03:14:39 +03:00
Drew Maxwell
7825221cd4 Updating Swift tests to remove outdated tests and use more current calls. 2022-09-16 15:11:10 -07:00
Doug Gregor
714eee0f52 Merge pull request #60720 from DougGregor/attribute-eof-parser-loop 2022-08-23 06:48:05 -07:00
Doug Gregor
28e1c304cf Allow declaration recovery to consume attributes.
Fixes https://github.com/apple/swift/issues/60702 / rdar://98967894
2022-08-22 21:45:25 -07:00
Holly Borla
cd7bc86bb1 [Test] Update error message in validation test. 2022-08-22 17:07:25 -04:00
Alex Hoppen
57d504cbcd Merge pull request #60062 from ahoppen/pr/placeholder-for-errors
[CS] Don’t fail constraint generation for ErrorExpr or if type fails to resolve
2022-07-20 14:15:43 +02:00
Alex Hoppen
e14fa7291f [CS] Don’t fail constraint generation for ErrorExpr or if type fails to resolve
Instead of failing constraint generation by returning `nullptr` for an `ErrorExpr` or returning a null type when a type fails to be resolved, return a fresh type variable. This allows the constraint solver to continue further and produce more meaningful diagnostics.

Most importantly, it allows us to produce a solution where previously constraint generation for a syntactic element had failed, which is required to type check multi-statement closures in result builders inside the constraint system.
2022-07-20 09:46:12 +02:00
nate-chandler
1e30ea9bff Merge pull request #60073 from nate-chandler/rdar81704151
[Test] Reenabled two tests.
2022-07-18 11:52:17 -07:00
Nate Chandler
674fc2c33a [Test] Reenabled two tests.
They should have been reenabled earlier.

rdar://81704151
2022-07-15 13:47:24 -07:00
Anthony Latsis
58a9778136 Add fixed crasher to close #43442 2022-07-09 16:47:55 +03:00
Alex Hoppen
97368698d4 Merge pull request #59664 from ahoppen/pr/cast-with-no-type
[TypeChecker] Don’t crash if a ExplicitCastExpr doesn’t have a cast type
2022-06-29 09:31:38 +02:00
Alex Hoppen
28a8e0762d [TypeChecker] Don’t crash if a ExplicitCastExpr doesn’t have a cast type
If the type of an `ExplicitCastExpr` is not valid, it is a null type, which causes a crash when checking if the cast type has parameterized existentials.

rdar://95629905
2022-06-27 17:21:53 +02:00
Anthony Latsis
767423a3c9 Add regression test to close #59572 2022-06-22 22:17:33 +03:00
Doug Gregor
774a94f69d Make sure we can dig out the (distributed) actor from an archetype.
Fixes #59356 / rdar://94976378.
2022-06-14 10:57:29 -07:00
Slava Pestov
0254c0ee7c RequirementMachine: Fix handling of unavailable Sendable conformances in concretizeNestedTypesFromConcreteParent()
We can't just ignore unavailable conformances because the
generic signature we're computing might itself be attached
to an unavailable declaration.

Until we get a proper fix, only drop unavailable conformances
to Sendable here.

Fixes rdar://problem/94305457.
2022-06-10 17:46:40 -04:00
Anthony Latsis
4bcb3713d0 Add regression test to close #56100 2022-06-05 21:59:10 +03:00
Doug Gregor
686655b61f Update expected diagnostics 2022-05-27 14:46:30 -07:00
Robert Widmann
663722d892 Parameterized Existential Types Are Enabled By Default
See https://forums.swift.org/t/accepted-se-0353-constrained-existential-types/57560
2022-05-25 09:50:36 -07:00
swift-ci
997ace439c Merge pull request #58562 from AnthonyLatsis/sr13589
Add regression test for #56024 crasher
2022-05-24 00:40:37 -07:00
Slava Pestov
dac8d666ee Stop passing -requirement-machine-{abstract,inferred,protocol}-signatures flags in tests
These flags are now no-ops.
2022-05-10 12:56:17 -04:00
Slava Pestov
f39372b33d RequirementMachine: Turn off redundant requirement warnings by default and add -warn-redundant-requirements frontend flag 2022-05-10 01:49:56 -04:00
Slava Pestov
0111618c50 RequirementMachine: Perform concrete contraction on protocol requirement signatures 2022-05-09 21:21:35 -04:00
Robert Widmann
930827aeb2 Ban Nested some Types in Existentials
We would like to leave room in the language for `some` types in existential
constraints a la `any P<some Q>` to resolve as a part of the requirement
signature of a future generalized existential type. To that end, usages of
`some` types nested anywhere in the arguments of an existential will fail to
resolve.

rdar://92758884
2022-05-04 19:21:32 -07:00
Anthony Latsis
d470eaadad Add regression test for #56024 crasher 2022-05-01 06:21:48 +03:00
Alex Hoppen
f652a9d01a Merge pull request #42295 from ahoppen/pr/add-fixed-test-cases
[IDE][Sema] Add test cases for issues no longer occurring in the stress tester
2022-04-27 11:32:44 +02:00
Alex Hoppen
e0205f7586 [Sema] Add test case for SR-15497
SR-15497 is no longer happening in the stress tester. Add its test case to the test suite.

rdar://85602946
2022-04-22 09:50:24 +02:00
nate-chandler
45ec725e43 Merge pull request #42485 from nate-chandler/rdar85526916
[SILGen] Use opaque AP for ObjC-async returns.
2022-04-20 16:43:02 -07:00