Commit Graph

589 Commits

Author SHA1 Message Date
Anthony Latsis
d8e5733a90 [NFC] Merge test/type/explicit_existential & test/type/explicit_existential_swift6 2024-07-25 08:59:20 -07:00
Anthony Latsis
6e5d6f1b3b ExistentialTypeSyntaxChecker: Fix any fix-it for IUO 2024-06-04 02:13:08 +03:00
Anthony Latsis
704244b477 ExistentialTypeSyntaxChecker: Fix any fix-it for inverse constraints 2024-06-04 02:13:08 +03:00
Anthony Latsis
89f6d2705e ExistentialTypeSyntaxChecker: Fix any fix-it for compositions 2024-06-04 02:13:08 +03:00
Anthony Latsis
8955625c3b ExistentialTypeSyntaxChecker: Fix any fix-it for higher-order metatypes 2024-06-04 02:13:08 +03:00
Anthony Latsis
b90b564f61 ExistentialTypeSyntaxChecker: Look through inverses 2024-06-04 02:13:08 +03:00
Anthony Latsis
44e5286d55 ExistentialTypeSyntaxChecker: Look through any and some 2024-06-04 02:13:08 +03:00
Anthony Latsis
1b6efc12ea [NFC] Reorganize and extend any syntax enforcement tests 2024-06-04 02:13:04 +03:00
Kavon Farvardin
0420310623 NCGenerics: it's no longer "experimental"
resolves rdar://127701059
2024-05-08 10:49:12 -07:00
Rintaro Ishizaki
8c67d15a32 Merge pull request #72550 from fummicc1/diagnostics-init-msg-improvement
[AST] Improve diagnostic message about `constructor` expression
2024-03-28 15:51:46 -07:00
fummicc1
4dda7efc0f [AST] Improve diagnostics message for swift users.
Use `initializer` instead of `constructor` because it is more official word to express its meaning.
2024-03-27 12:32:25 +09:00
Pavel Yaskevich
25ce6604cd [CSDiagnostics] Add a diagnostic for superclass requirement failure in opaque return type 2024-03-26 12:07:14 -07:00
Pavel Yaskevich
08e93825d2 [CSDiagnostics] Add a diagnostic for same-type requirement failure in opaque return type
Follow-up to https://github.com/apple/swift/pull/72493
2024-03-26 11:11:30 -07:00
Pavel Yaskevich
e0da21b777 [Tests] NFC: Add a couple of tests for parametrized opaque result types 2024-03-21 11:38:52 -07:00
Kavon Farvardin
18f00668ce NCGenerics: fix ExistentialAny handling
The checking for ExistentialAny diagnostics needed to be updated to both
 handle the new Copyable/Escapable protocols that appear in the Any and
 AnyObject existential layouts.

resolves rdar://123332844
2024-02-27 14:15:34 -08:00
Slava Pestov
48f46f0e3c Sema: Redo the normalization in TypeResolver::resolveCompositionType() 2024-02-24 07:25:59 -05:00
Kavon Farvardin
f296d8e158 NCGenerics: mass XFAIL tests
It's easier to get a handle on regressions while working through
failures if the tests that are known to not pass are XFAIL'd for
NoncopyableGenerics.
2024-02-20 18:26:05 -05:00
Anthony Latsis
ef931342ad AST/ASTWalker: Refactor for recursive MemberTypeRepr representation 2024-02-09 17:33:21 +03:00
Slava Pestov
ea15d9f9b2 Stop passing -warn-redundant-requirements in tests 2024-02-02 14:57:19 -05:00
Slava Pestov
73c18fb668 Sema: Better distinguish scalar from variadic generic argument positions, and reject pack expansion types there
We used to disallow pack expansions in generic argument lists of
protocols, but allow them for all other nominal types. However,
we only actually checked that the pack expansions match up if
the type itself was variadic.

Fix this by repurposing Context::ProtocolGenericArgument into
Context::ScalarGenericArgument, and using that when the type does
not have a parameter pack.

Context::GenericArgument is now Context::VariadicGenericArgument,
and we only use it if the type has a parameter pack, in which case
we use the PackMatcher, so any pack expansions in the wrong place
are caught there.

Fixes rdar://116716014 and https://github.com/apple/swift/issues/69088.
2023-10-11 10:39:26 -04:00
Pavel Yaskevich
c5138a385a Merge pull request #68459 from mininny/error-on-inout-on-invalid-parameter
Fix inaccurate error on inout in wrong parameter type
2023-09-25 08:32:23 +01:00
Minhyuk Kim
c0eab4f551 Change error message to specify when inout usage is allowed 2023-09-24 23:18:27 +09:00
Kavon Farvardin
a69f9e434d experimental feature tests require asserts
When using an experimental feature that is not available
in production, a test needs to have `REQUIRES: asserts`
so that non-assert builds don't unexpectedly fail.
2023-09-23 19:52:45 -07:00
Minhyuk Kim
d9a03dda17 [Sema] Produce better diagnostics when using inout on parameter types that cannot be 'inout'. Resolves #68417 2023-09-23 22:15:13 +09:00
Slava Pestov
b6f8f81ec1 Sema: Don't allow PackExpansionType in the generic arguments of a ParameterizedProtocolType
We already had a separate TypeResolverContext::ProtocolGenericArgument that
did not allow PackExpansionTypes, but it was never used.

Fixes rdar://problem/115538574.
2023-09-19 23:03:59 -04:00
Alex Hoppen
baa20aec52 Merge pull request #67909 from nishithshah2211/imperative-fixits
[Diagnostics] Use imperative msg for protocol conformance & switch-case fixits
2023-08-21 14:40:21 -07:00
Pavel Yaskevich
4bd60aeb4e [Tests] NFC: Remove/adjust runtime metadata related test cases 2023-08-15 12:17:31 -07:00
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
3e436d316f Sema: Fix two problems in checkReferencedGenericParams() analysis
- Don't walk into the count type of a PackExpansionType, because
  when matching two PackExpansionTypes, the solver only introduces
  a shape constraint between the count types, which does not fix it
  to a concrete type.

- Similarly, don't walk into type alias substitutions, because
  only the desugared type is considered by the constraint solver.

This is mildly source breaking, in that before we let you declare
generic functions that could not be called.
2023-07-27 12:16:06 -04:00
Holly Borla
43c300408b [NFC] Update additional parameter pack tests. 2023-07-20 15:36:20 -07:00
Slava Pestov
89ad597fe3 Sema: Use getAllMembers() from collectVisibleMemberDecls()
I had to disable typo correction in one test case to get it to pass without
diagnosing a cycle as a result of Sendable checking. But that's OK, because:

- Sendable checking is prone to request cycles and needs to be redesigned
- Typo correction is turned off in production
2023-06-30 12:40:34 -04:00
Slava Pestov
1957bd6065 Sema: Reword diagnostics to say 'without a type annotation' instead of 'without more context' 2023-06-09 17:44:42 -04:00
Pavel Yaskevich
3b1f392d0a Merge pull request #65785 from angela-laar/fix-covariant-erasure-for-constrained-existentials
Fix covariant erasure for constrained existentials
2023-05-18 16:58:45 -07:00
Slava Pestov
e9e6a51c82 Unconditionally enable variadic generic types now that SE-0398 has been accepted 2023-05-15 23:32:52 -04:00
Anthony Latsis
3f629315a9 Merge pull request #65731 from AnthonyLatsis/always-print-any
ASTPrinter: Turn on explicit `any` printing for everything and remove the option to disable it
2023-05-16 03:27:36 +03:00
Angela Laar
5c818b3fd4 [Constraint System] Fix covariant erasure for constrained existentials
Constrained existentials should be type erased to an upper bound that is dependent on other type parameters.
2023-05-15 16:17:59 -07:00
Slava Pestov
4318a36be6 Sema: Availability checking for variadic generic types 2023-05-12 22:50:25 -04:00
Slava Pestov
02258c1cf3 AST: It's not 'opaque' anymore 2023-05-12 22:05:28 -04:00
Anthony Latsis
7f6d3bcd41 ASTPrinter: Turn on explicit any printing for everything and remove the option to disable it 2023-05-13 02:55:49 +03:00
Slava Pestov
8f71dc928f Sema: Diagnose variadic enums, and inheritance from variadic classes
These are just temporary limitations.
2023-05-08 12:57:33 -04:00
Slava Pestov
df5d531dc6 ASTPrinter: Fix printing of pack requirements
Also remove the flag for printing 'each' and make it always on.
2023-04-19 13:04:51 -04:00
Holly Borla
35fcc37136 Merge pull request #65134 from hborla/parameter-pack-revision
[SE-0393] Require the `repeat` keyword for generic requirement expansions.
2023-04-13 08:33:25 -07:00
Holly Borla
234b5dc660 [SE-0393] Require the repeat keyword for generic requirement expansions. 2023-04-12 22:04:01 -07:00
Anthony Latsis
8d1d526195 TypeCheckType: Fix existential 'any' migration diagnostics for extra-modular protocols 2023-04-13 03:37:25 +03:00
Sophia Poirier
a3baee9498 [Variadic Generics] fixit to remove keyword 'each' on non-pack types 2023-04-03 17:26:25 -07:00
Angela Laar
175e712b73 Merge pull request #64037 from angela-laar/fix-generic-type-paramters-implicit-some
[NameLookup] Collect implicit opaque GenericParams
2023-03-27 10:18:31 -07:00
Holly Borla
da3079de05 [ConstraintSystem] Diagnose pack expansion expressions in non-variadic contexts. 2023-03-21 21:58:05 -07:00
Angela Laar
c3eb22abda [test] test generic params with implicit some 2023-03-21 14:44:11 -07:00
Sophia Poirier
19e671b5f2 [Variadic Generics] distinctly diagnose more types of pack expansion errors + add fixits 2023-03-20 15:51:19 -07:00
Slava Pestov
2fa344bf85 AST: Tweak some variadic generic diagnostics 2023-03-15 23:04:50 -04:00