Holly Borla
9ba481ad53
[Diagnostics] Clarify the wording of error_in_future_swift_version.
2024-03-01 12:05:51 -08:00
Slava Pestov
1b99dd2451
RequirementMachine: Tweak RewriteSystem::recordConflict() heuristic again
2024-02-29 18:13:28 -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
Slava Pestov
70c9f8a47e
RequirementMachine: Leave behind conflicting requirements in the minimized signature
...
Requirement lowering only expects that it won't see two requirements
of the same kind (except for conformance requirements). So only mark
those as conflicting.
This addresses a crash-on-invalid and improves diagnostics for
move-only generics, because a conflict won't drop the copyability
of a generic parameter and expose a move-only-naive user to
confusing error messages.
Fixes #61031 .
Fixes #63997 .
Fixes rdar://problem/111991454.
2024-02-15 14:32:31 -05:00
Slava Pestov
ea15d9f9b2
Stop passing -warn-redundant-requirements in tests
2024-02-02 14:57:19 -05:00
Alex Hoppen
a05ab76249
Re-enable test/Generics/requirement_machine_diagnostics.swift
...
The underlying issue should be fixed by https://github.com/apple/swift-syntax/pull/1399
rdar://106457182
2023-03-10 15:08:41 -08:00
Nate Chandler
ee3fb5e4eb
[Test] Disabled test failing in macOS PR testing.
...
rdar://106457182
2023-03-08 15:51:44 -08: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
75f6682969
RequirementMachine: Enable concrete contraction for nested type parameters
...
Fixes rdar://problem/91594361.
2022-05-09 21:21:35 -04:00
Holly Borla
7f30f5b039
[RequirementMachine] Downgrade concrete type parameter diagnostics to a
...
warning.
These diagnostics are stricter in the RequirementMachine than in the GSB,
and there's code that relies on the more relaxed diagnostics in the source
compatibility suite. Downgrade these diagnostics to a warning using
warnUntilSwiftVersion(6).
2022-04-11 19:18:00 -07:00
Holly Borla
236e8e2b1d
[RequirementMachine] Diagnose type parameters that are made concrete by a
...
same-type requirement.
2022-04-08 18:16:23 -07:00
Holly Borla
85be43f18f
[RequirementMachine] Omit duplicate conflict diagnostics.
2022-03-30 22:50:13 -07:00
Holly Borla
7e5c48382d
[RequirementMachine] When computing requirements for conflict diagnostics,
...
adjust the concrete type symbol for the suffix rule by applying the prefix
from the subject rule.
2022-03-30 22:30:45 -07:00
Holly Borla
78b07565b6
[RequirementMachine] Use PropertyMap::getTypeFromSubstitutionSchema when
...
computing a concrete same-type or superclass for conflict diagnostics.
Otherwise, diagnostics will show fresh type parameters when the concrete
type is generic.
2022-03-30 14:09:06 -07:00
Holly Borla
a4230a6061
[RequirementMachine] Simplify computing and emitting conflict diagnostics.
...
Instead of computing different combinations of conflicting requirement kinds,
emit the same error message for all of them.
2022-03-29 18:27:45 -07:00
Holly Borla
31028e5a9f
[RequirementMachine] When computing conflict diagnostics, only compute the
...
type for the longer subject term between the two conflicting rules.
2022-03-29 18:27:45 -07:00
Holly Borla
caee699560
[RequirementMachine] Mention the type parameter that is the subject of
...
two conflicting requirements in diagnostics where possible.
2022-03-29 18:27:45 -07:00
Holly Borla
99f5e365cc
[RequirementMachine] Compute and diagnose conflicting rules in the minimal
...
rewrite system of a generic/requirement signature.
2022-03-29 18:26:26 -07:00
Slava Pestov
3571fa8860
AST: Preserve sugar in TypeMatcher::visitBoundGenericType()
2022-03-21 16:26:40 -04:00
Slava Pestov
298a84a202
RequirementMachine: Preserve sugar in desugarSameTypeRequirement()
2022-03-21 16:26:40 -04:00
Holly Borla
6b64ac26f4
[RequirementMachine] Suppress redundant requirement warnings for inferred
...
requirements.
2022-03-15 21:14:43 -07:00
Holly Borla
2f7018b605
[RequirementMachine] Don't suppress redundancy diagnostics when the
...
non-explicit, non-redundant replacement rule is not in the rewrite
system's minimization domain.
2022-03-09 12:14:58 -08:00
Holly Borla
397684909b
[RequirementMachine] Suppress redundancy warnings when an explicit, redundant
...
rule has a non-explicit, non-redundant rule in its rewrite path.
This fixes bogus redundancy diagnostics in cases where the canonical form
of a redundant rule is not explicit in source, e.g.
protocol Swappable2 {
associatedtype A
associatedtype B
associatedtype Swapped : Swappable2
where Swapped.B == A,
Swapped.Swapped == Self
}
in the above case, the canonical rule for `Swapped.B == A` is the rule
[Swappable2:Swapped].[Swappable2:A] => [Swappable2:B], which is not
explicit.
2022-03-09 12:14:58 -08:00
Holly Borla
a154641288
[RequirementMachine] Propagate explicit requirement IDs from redundant
...
rules in a separate pass after homotopy reduction.
RewriteSystem::propagateExplicitBits was too eager in propagating
IDs from explicit rules within rewrite loops, which resulted in bogus
redundancy warnings when the canonical form of an explicit rule was
given a different requirement ID. Instead, propagate requirement IDs
after homotopy reduction when redundant rules are computed and rewrite
loops are simplified.
2022-03-09 12:14:58 -08:00
Holly Borla
be30d76732
[RequirementMachine] Diagnose redundant requirements found during minimization
...
of the rewrite system.
2022-03-09 12:14:58 -08:00
Holly Borla
b18e815436
[RequirementMachine] Preserve structural requirements during rule construction,
...
and diagnose trivially redundant rules in the rewrite system.
2022-03-09 12:14:58 -08:00
Holly Borla
e966c6a856
[NFC][RequirementMachine] Fix duplicate diagnostics in requirement machine
...
tests.
2022-02-16 14:04:40 -08:00
Holly Borla
04a91fe61d
[RequirementMachine] Suppress requirement diagnostics when one of the
...
types already has an error.
2022-02-16 13:11:57 -08:00
Holly Borla
d5814ae3e5
[RequirementMachine] Only emit a redundancy warning for layout constraints
...
if the type is constrained to a class layout, and add a few more test cases
for type requirement conflicts.
2022-02-16 13:11:57 -08:00
Holly Borla
e6dc7e69c1
[RequirementMachine] Emit diagnostics for structural requirements in protocol
...
and typealias requirement signatures.
2022-02-16 13:11:57 -08:00
Holly Borla
3837b4def4
[RequirementMachine] Diagnose early redundant requirements.
2022-02-16 13:11:57 -08:00
Holly Borla
203734bea4
[RequirementMachine] Diagnose conformance, layout, and superclass constraints
...
on non-type-parameters in the requirement machine.
2022-02-16 13:11:57 -08:00
Holly Borla
e4cba889c2
[RequirementMachine] Diagnose concrete same-type mismatches, such as
...
`where String == Int`.
2022-02-16 13:11:57 -08:00
Holly Borla
a74717ab69
[RequirementMachine] Diagnose non-protocol, non-class conformance/subtype
...
constraints in the requirement machine.
2022-02-16 13:11:56 -08:00