Commit Graph

1324 Commits

Author SHA1 Message Date
Pavel Yaskevich
2db14a9148 [CSDiag] NFC: Remove obsolete function diagnostics from visitApplyExpr 2019-12-13 22:50:46 -08:00
Slava Pestov
a9249287a1 Sema: Remove some dead code from CSDiag 2019-12-13 15:35:38 -05:00
Holly Borla
5ec28a6116 [CSDiag] Remove diagnoseClosureExplicitParameterMismatch. 2019-12-12 20:47:00 -08:00
Holly Borla
3d1ab4da67 Merge pull request #28712 from hborla/function-parameter-mismatch-diagnostics
[ConstraintSystem] Port function parameter type mismatch diagnostics.
2019-12-11 14:33:07 -08:00
Holly Borla
51c7c8c8f1 [ConstraintSystem] Port function parameter type mismatch diagnostics. 2019-12-11 10:45:52 -08:00
Brent Royal-Gordon
addbe3e5ed [NFC] Thread DeclNameRef through most of the compiler
This huge commit contains as many of the mechanical changes as possible.
2019-12-11 00:55:18 -08:00
Holly Borla
edb4e70d66 Merge pull request #28600 from hborla/tuple-mismatch-diagnostics
[ConstraintSystem] Port tuple type mismatch diagnostics
2019-12-09 13:26:34 -08:00
Pavel Yaskevich
0170c8949d [CSDiag] NFC: Remove obsolete @dynamicCallable diagnostics 2019-12-06 16:43:18 -08:00
Holly Borla
f9a1ab28f4 [ConstraintSystem] Port tuple type mismatches to the new framework 2019-12-06 13:12:57 -08:00
Hamish Knight
a97328dcbf [CS] Use a MapVector to cache resolved overloads
Rather than maintaining a linked list of overload
choices, which must be linearly searched each time
we need to lookup an overload at a given callee
locator, use a MapVector which can be rolled back
at the end of a scope.

Remove ResolvedOverloadSetListItem in favor of
using SelectedOverload, which avoids the need to
convert between them when moving from
ConstraintSystem to Solution.
2019-12-05 14:47:52 -08:00
Pavel Yaskevich
5c56eea904 [CSDiag] Remove obsolete logic related to closure expression handling 2019-12-04 14:24:41 -08:00
Pavel Yaskevich
94b4052321 [CSDiag] NFC: Remove all of the obsolete diagnoseGeneral*Failures logic 2019-12-03 12:07:16 -08:00
Hamish Knight
778e130f31 [Sema] Add TypeBase::isCallableNominalType
This checks whether a type supports being called
via callAsFunction. A request is used in order to
cache the result of this query.
2019-12-02 15:29:21 -08:00
David Moore
6a0d540949 Sema: Improve @dynamicCallable Diagnostics for Incorrect Parameter Types 2019-11-26 15:02:02 -05:00
Pavel Yaskevich
addc2b06ab [ConstraintSystem] Introduce notion of constraint system phase
Some constraint transformations require knowledge about what state
constraint system is currently in e.g. `constraint generation`,
`solving` or `diagnostics` to make a decision whether simplication
is possible. Notable example is `keypath dynamic member lookup`
which requires a presence of `applicable fn` constraint to retrieve
some contextual information.

Currently presence or absence of solver state is used to determine
whether constraint system is in `constraint generation` or `solving`
phase, but it's incorrect in case of `diagnoseFailureForExpr` which
tries to simplify leftover "active" constraints before it can attempt
type-check based diagnostics.

To make this more robust let's introduce (maybe temporarily until
type-check based diagnostics are completely obsoleted) a proper
notion of "phase" to constraint system so it is always clear what
transitions are allowed and what state constraint system is
currently in.

Resolves: rdar://problem/57201781
2019-11-20 18:34:51 -08:00
Pavel Yaskevich
eb3a1b3f82 [CSDiag] NFC: Remove obsolete explicit closure result mismatch handling 2019-11-13 14:06:51 -08:00
Robert Widmann
efb6117bd8 [NFC] Remove Diagnostic State From TypeChecker
Push this map into ConstraintSystem and have the search and retrieval chain up the linked list of base constraint systems.
2019-11-10 22:05:32 -08:00
Robert Widmann
535150c7c6 Move preCheckExpression to ConstraintSystem 2019-11-10 13:48:03 -08:00
Robert Widmann
7bad9aacc3 Drop the TypeChecker out of ConstraintSystem 2019-11-10 13:26:47 -08:00
Robert Widmann
e7ef8abd3a Migrate getTypeOfExpressionWithoutApplying 2019-11-10 13:15:55 -08:00
Robert Widmann
1123b1f897 Move constraint satisfiability utilities 2019-11-10 13:12:50 -08:00
Robert Widmann
d21424b58b Make typeCheckExpression a utility 2019-11-10 12:40:09 -08:00
Doug Gregor
bc926f7eb7 [Constraint system] Drop the root expression from FailureDiagnostic.
We're not using it for anything, now.
2019-11-08 22:38:49 -08:00
Hamish Knight
f519505c8b Remove some more TypeChecker uses (#28132)
Remove some more TypeChecker uses
2019-11-07 17:56:45 -08:00
Robert Widmann
41ab235797 [CS] Remove some TypeChecker uses 2019-11-07 12:41:37 -08:00
Pavel Yaskevich
c3acce4d69 [CSDiag] Remove obsolete ArgumentMatcher from FailureDiagnosis
All of the argument diagnostics have been ported to the new diagnostic
framework, so now is the time to remove `ArgumentMatcher` and the only
place where it was used - `diagnoseSingleCandidateFailures`.
2019-11-07 11:17:01 -08:00
Robert Widmann
3cf7b5451e Remove references to TypeChecker in the constraint system 2019-11-06 15:08:59 -08:00
Robert Widmann
c4a0585ba5 Make getObjectLiteralConstructorName a utility 2019-11-06 15:08:59 -08:00
Pavel Yaskevich
6d02fb7815 Merge pull request #28057 from xedin/assign-diags
[Diagnostics] Port the rest of assignment diagnostics to the new framework
2019-11-06 00:11:08 -08:00
Robert Widmann
e804d6ed9a Make TypeChecker::getDefaultType a utility 2019-11-05 20:31:15 -08:00
Pavel Yaskevich
56f4215f7f [CSDiag] NFC: Remove obsolete handling of type mismatches in unresolved members refs 2019-11-05 12:46:15 -08:00
Pavel Yaskevich
7cc603390a [CSDiag] Remove obsolete FailureDiagnosis::visit{Assign, InOut}Expr 2019-11-05 12:46:15 -08:00
Pavel Yaskevich
7cd7cd43e6 [Diagnostics] Port self assignment diagnostic to the new framework 2019-11-05 12:38:13 -08:00
Holly Borla
561e527848 [ConstraintSystem] Extend the ExplicitlySpecifyGenericArguments fix to cover
all cases of missing generic parameters.

In `ComponentStep::take` when there are no bindings or disjunctions, use hole
propagation to default remaining free type variables that aren't for generic
parameters and continue solving. Rather than using a defaultable constraint for
holes, assign a fixed type directly when we have no bindings to try.
2019-11-05 09:15:13 -08:00
Luciano Almeida
095bb5bac7 [CSDiag] Removing invalid_optional_chain diagnostic from CSDiag 2019-11-04 01:13:51 -03:00
Luciano Almeida
43a3ca46c9 Removing invalid force unwrap from CSDiag 2019-11-03 23:21:14 -03:00
Pavel Yaskevich
ddb7bbc25b [CSDiag] NFC: Remove obsolete trailing closure diagnostics 2019-11-01 10:36:20 -07:00
Robert Widmann
5a7040e2a4 Remove PossiblyInvalidDecls 2019-10-30 15:09:14 -07:00
Robert Widmann
41d099bc91 Remove the argument to setInvalid() 2019-10-30 15:09:14 -07:00
Robert Widmann
89b81a28da Fixup calls to TypeChecker::lookupXXX 2019-10-30 12:55:42 -07:00
Robert Widmann
118f68b1be Make getProtocol and getLiteralProtocol static utilities 2019-10-30 12:55:42 -07:00
Robert Widmann
972e755e9b Give ConstraintSystem's outlet to the ASTContext
Make it less tempting to ask for the type checker embedded into
ConstraintSystem by using the accessor to the ASTContext.
2019-10-30 12:55:42 -07:00
Robert Widmann
da2b063af9 Make calls to lookupMember actually look static 2019-10-30 12:55:42 -07:00
Robert Widmann
b849e51768 Use operator bool to claw back some readability 2019-10-29 16:56:21 -07:00
Robert Widmann
3e1a61f425 [NFC] Fold The Tri-State In Optional<ProtocolConformanceRef>
ProtocolConformanceRef already has an invalid state.  Drop all of the
uses of Optional<ProtocolConformanceRef> and just use
ProtocolConformanceRef::forInvalid() to represent it.  Mechanically
translate all of the callers and callsites to use this new
representation.
2019-10-29 16:55:56 -07:00
Anthony Latsis
d64d45d3d6 @lvalue exposure fixes & prevention 2019-10-22 04:30:40 +03:00
Holly Borla
e5c99cace6 Merge pull request #27769 from hborla/anyobject-conformance-failure
[ConstraintSystem] Diagnose missing AnyObject conformance using the MissingConformance constraint fix.
2019-10-18 22:10:21 -04:00
Holly Borla
04637adce3 [CSDiag] Remove diagnoseTypeRequirementFailure and
diagnoseUnresolvedDotExprTypeRequirementFailure.
2019-10-18 15:42:20 -07:00
Pavel Yaskevich
8d05192204 Merge pull request #27728 from xedin/port-extraneous-args
[Diagnostics] Diagnose extraneous argument(s) via fixes
2019-10-18 10:42:56 -07:00
Pavel Yaskevich
c47a40c779 [CSDiag] NFC: Remove visitKeyPathExpr which is now obsolete 2019-10-17 13:52:40 -07:00