Josh Soref
81d3ad76ac
Spelling ast ( #42463 )
...
* spelling: accessor
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: accommodates
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: argument
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: associated
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: availability
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: available
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: belongs
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: bookkeeping
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: building
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: clazz
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: clonable
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: closure
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: concatenated
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: conformance
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: context
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: conversion
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: correspondence
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: declarations
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: declared
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: defining
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: delayed
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: dependency
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: deployed
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: descendants
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: diagnose
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: diagnostic
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: equitable
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: evaluation
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: exclusivity
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: existence
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: existential
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: explicit
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: expressed
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: for
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: foreign
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: function
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: identifier
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: implicit
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: indices
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: information
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: instance
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: interchangeable
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: interface
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: introduced
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: invalid
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: kind-in
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: least
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: library
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: location
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: namespace
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: necessary
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: nonexistent
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: not
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: number
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: obtains
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: occurs
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: opaque
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: overridden
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: parameter
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: precede
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: preceding
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: property
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: protocol
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: qualified
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: recognized
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: recursively
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: references
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: relaxing
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: represented
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: request
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: requirement
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: requirements
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: retrieve
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: returned
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: satisfied
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: satisfy
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: scanner
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: siblings
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: simplified
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: something
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: source
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: specializations
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: specially
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: statement
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: stripped
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: structure
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: substitution
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: the
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: transform
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: transformed
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: transitively
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: transparent
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: typecheck
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: unknown
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: unlabeled
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: unqualified
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: whether
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: with
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: scanner
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
Co-authored-by: Josh Soref <jsoref@users.noreply.github.com >
2022-04-21 12:57:16 -07:00
Slava Pestov
504b2ebd4e
RequirementMachine: Change an isExistentialType() to isConstraintType()
2022-04-21 13:49:34 -04:00
Holly Borla
de41a58051
Merge pull request #42257 from hborla/concrete-generic-params
...
[RequirementMachine] Diagnose type parameters that are made concrete by a same-type requirement.
2022-04-12 18:27:43 -07:00
Slava Pestov
7aee5b6cf8
Merge pull request #42324 from slavapestov/rqm-superclass-vs-objc-existential
...
RequirementMachine: Allow 'any C & P' to satisfy a superclass requirement 'C' if 'P' is an @objc protocol
2022-04-12 21:05:52 -04:00
Slava Pestov
4204e20508
RequirementMachine: Allow 'any C & P' to satisfy a superclass requirement 'C' if 'P' is an @objc protocol
...
The GenericSignatureBuilder did not actually allow this, but it's conflict
detection was imperfect so it did not flag the example in the radar;
variations on this code were rejected by the GenericSignatureBuilder.
Since the Requirement Machine finds all conflicts correctly, relax the
logic here to make this example work.
Fixes rdar://problem/91637621.
2022-04-12 16:43:56 -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
Slava Pestov
9170378d25
RequirementMachine: Fix handling of Sendable conformances for superclass requirements
...
Don't set allowMissing to true when checking conformance of a superclass requirement
to a protocol, since this prevents us from being able to express something like
'T : C, T : Sendable' to mean 'T can be any subclass of C which is also Sendable'.
Fixes rdar://problem/91530343.
2022-04-11 14:52:32 -04:00
Holly Borla
e26497a644
[RequirementMachine] Remove unnecessary conditions in concrete type parameter
...
diagnostics code.
2022-04-09 13:10:36 -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
Doug Gregor
f3fd64a71b
Support missing Sendable conformances everywhere in the requirement machine
2022-04-08 16:10:38 -07:00
Doug Gregor
45c7d6f4b8
Allow missing Sendable conformances when type parametesr are made concrete.
...
Fixes rdar://91174106.
2022-04-08 15:42:33 -07:00
Slava Pestov
094130b9c7
RequirementMachine: Diagnose redundant concrete conformance requirements
...
A conformance requirement on a concrete type parameter is redundant if the
concrete type conforms to the protocol.
The replacement path for the conformance rule is based on a concrete
conformance rule introduced by the property map. Since the concrete
conformance rule is not associated with a requirement ID, this would
normally muffle the redundancy warning, because we don't want to
suggest removing a rule that depends on a non-redundant, non-explicit
rule.
However, concrete conformance rules don't actually appear in the
minimal signature, so skip them when computing the set of non-redundant,
non-explicit rules to ensure that the original conformance requirement
is still diagnosed as redundant.
2022-04-05 21:12:51 -04:00
Slava Pestov
4d15fa0087
RequirementMachine: Don't diagnose trivial circularity 'protocol P : P' as redundant
...
Every protocol gets an 'identity conformance' rule [P].[P] => [P].
A trivially-stated circularity is always redundant because of this
rule, and we diagnose circular inheritance elsewhere as a hard
error, so just add a special case to skip adding such a rule here
to avoid the useless warning on top of the existing error.
2022-04-05 21:12:51 -04:00
Slava Pestov
bc43cdd104
RequirementMachine: Generalize hack that allows associated type inheritance clauses to reference protocol typealiases
...
We want to allow this for all conformance requirements written in protocols
or the `where` clause of protocol extensions.
Fixes rdar://problem/91304291.
2022-04-05 18:42:35 -04:00
Slava Pestov
85e73ed021
RequirementMachine: Move a bit of code in computeCompletion() for clarity
2022-04-05 00:04:39 -04:00
Slava Pestov
c0c109d3f5
RequirementMachine: Tighten verifyRewriteRules() further
...
We should never have a rule with a protocol symbol on the *right* hand
side, like (T => U.[P]).
2022-04-04 23:52:58 -04:00
Slava Pestov
4c7fc73d4a
RequirementMachine: Try harder to ensure completion only introduces property-like rules
...
When computing an overlap between a property-like rule (T.[p] => T for some
property symbol [p]) and another rule, try harder to ensure that the new
rule is a property-like rule.
In a conformance-valid rewrite system, all rules that are not LHS- or RHS-
simplified will eventually either be property-like or same-type rules, but
we need to maintain this invariant for that rules that become simplified
as well, to ensure that rewrite loops have a certain structure that is
important for the minimal conformances algorithm.
I don't quite understand why to be honest, but I'm close to figuring it
out.
Fixes rdar://problem/91232987.
2022-04-04 23:41:07 -04:00
Slava Pestov
41c04c5f7b
RequirementMachine: Add a comment explaining a recent change to concrete contraction
2022-04-04 12:41:57 -04:00
Slava Pestov
6b48eb6549
RequirementMachine: More debug output from RewritePath::RewriteSystem::propagateRedundantRequirementIDs()
2022-04-04 12:41:57 -04:00
Slava Pestov
7d51fa9f62
RequirementMachine: RewriteSystem::dump() prints out written requirements
2022-04-04 12:41:57 -04:00
Slava Pestov
5bff2a02c5
RequirementMachine: Rename RewritePath::getRulesInEmptyContext() to findRulesAppearingOnceInEmptyContext()
2022-04-04 12:41:57 -04:00
Slava Pestov
deaeb36f57
RequirementMachine: Make RewritePath::getRulesInEmptyContext() const
2022-04-04 12:41:57 -04:00
Slava Pestov
02bfb79935
RequirementMachine: Concrete contraction discards errors from inferred requirements
2022-04-01 23:55:19 -04:00
Slava Pestov
175d5860cf
RequirementMachine: Don't substitute unsatisfied layout requirements in concrete contraction
2022-04-01 23:06:19 -04:00
Slava Pestov
06b181a099
RequirementMachine: Don't record duplicate conflicts in PropertyMap::checkConcreteTypeRequirements()
2022-04-01 22:38:42 -04:00
Slava Pestov
d385b73cd6
RequirementMachine: Plumb source locations through concrete contraction
2022-04-01 22:33:03 -04:00
Slava Pestov
0e297b0fbb
RequirementMachine: Use Requirement::hasError() method
2022-04-01 21:40:55 -04:00
Slava Pestov
4e89f73e90
RequirementMachine: Allow markConflicting() on already-conflicting frozen rules
2022-04-01 01:05:54 -04:00
Slava Pestov
a8190d81da
RequirementMachine: Don't record duplicate superclass conflicts
2022-04-01 01:05:54 -04:00
Slava Pestov
d212041dfb
RequirementMachine: Fold RewriteSystem::processConflicts() into recordConflict() and add debug output
2022-04-01 01:05:54 -04:00
Slava Pestov
75161ce6b0
RequirementMachine: Tweak fixit that turns 'T : Int' into 'T == Int' slightly to match GSB
2022-04-01 01:05:54 -04:00
Slava Pestov
22f0f40a30
RequirementMachine: Copy over GSB logic where inheritance of JSExport protocol can be re-stated redundantly
2022-04-01 01:04:54 -04:00
Slava Pestov
01fea564fb
RequirementMachine: Skip emitting diagnostics containing ErrorTypes
2022-04-01 01:04:54 -04:00
Holly Borla
ce600d8728
Merge pull request #41971 from hborla/conflicting-requirement-diagnostics
...
[RequirementMachine] Diagnose conflicting requirements.
2022-03-31 09:14:11 -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
5296fbdf45
[NFC][RequirementMachine] Stylistic changes for computing confict
...
diagnostics.
Move computing requirements from rules into a static function, make
a few variables const, etc.
2022-03-30 14:09:06 -07:00
Holly Borla
f52593be68
[RequirementMachine] Record the sugared 'Self' type parameter when
...
initializing a RequirementMachine for a written protocol signature.
These generic parameters are used for re-sugaring when computing a
type from a term, so if the recorded 'Self' parameter is canonicalized,
it shows up in diagnostics as 'tau_0_0'.
2022-03-29 18:27:45 -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
964c11a4d0
[RequirementMachine] Consolidate the various RequirementError::Kind cases
...
that represent conflict diagnostics.
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
deb62f7e3c
[RequirementMachine] Add a helper method to RequirementMachine to compute
...
all requirement diagnostics from the minimal rewrite system.
2022-03-29 18:27:44 -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
Holly Borla
e512e7a824
[RequirementMachine] Add a RequirementError for diagnosing a conflicting
...
same-type requirement.
2022-03-29 18:23:53 -07:00
Slava Pestov
ad2f73af44
RequirementMachine: More comments
2022-03-29 12:10:33 -04:00
Slava Pestov
3cfbe037ee
RequirementMachine: Simplify getTypeForSymbolRange() a bit
2022-03-29 00:43:41 -04:00
Slava Pestov
a631d8aa3a
RequirementMachine: Write some comments
2022-03-28 22:16:09 -04:00
Slava Pestov
132334cda9
RequirementMachine: Add debugging flag to disable re-using requirement machines
2022-03-27 11:54:28 -04:00