Commit Graph

1357 Commits

Author SHA1 Message Date
Pavel Yaskevich
1c0bdc88d3 Merge pull request #29413 from LucianoPAlmeida/remove-visit-identity-expr-csdiag
[Diagnostics] Remove obsolete FailureDiagnosis::visitIdentityExpr from CSDiag
2020-01-24 14:03:31 -08:00
Holly Borla
af847c2f79 Merge pull request #29415 from hborla/ambiguity-special-cases
[CSDiag] Start chipping away at FailureDiagnosis::diagnoseAmbiguity
2020-01-24 13:59:43 -08:00
Luciano Almeida
2c7cc7b829 [CSDiag] Remove obsolete FailureDiagnosis::visitIdentityExpr from CSDiag 2020-01-24 10:35:24 -03:00
Holly Borla
689a57b8a0 [CSDiag] Remove some dead code for diagnosing ambiguity from CSDiag. 2020-01-23 16:22:15 -08:00
Doug Gregor
133439dcbb [Constraint solver] Request contextual type information per expression.
When requesting information about the contextual type of a constraint
system, do so using a given expression rather than treating it like
the global state that it is.
2020-01-23 11:46:17 -08:00
Holly Borla
74f65ba2ce [ConstraintSystem] Find solutions for code with invalid '_' using
holes.
2020-01-23 10:48:55 -08:00
Holly Borla
0c00d45d53 [CSDiag] Remove CalleeCandidateInfo::diagnoseSimpleErrors, which is
dead code now.
2020-01-22 10:57:52 -08:00
Holly Borla
86cf6dc03e [ConstraintSystem] Finish porting member failure diagnostics.
Remove special cases for AnyObject member and dynamic member lookup
failures - these are now all handled in the new diagnostic
infrastructure.
2020-01-22 10:57:52 -08:00
Luciano Almeida
94dd355604 [CSDiag] Remove FailureDiagnosis:: visitObjectLiteralExpr from CSDiag 2020-01-21 11:54:26 -03:00
Pavel Yaskevich
0aadb7c6a5 [CSDiag] NFC: Move findResolvedMemberRef to ConstraintSystem.cpp
This method is used by diagnostics and CSApply at this point.
2020-01-14 12:51:58 -08:00
Pavel Yaskevich
2164476bf5 [Diagnostics] Port diagnostics related to dictionary literal use 2020-01-13 12:41:07 -08:00
Pavel Yaskevich
f2942ebb56 [Diagnostics] Port diagnostics related to array literal use 2020-01-13 11:54:59 -08:00
Doug Gregor
946eee9cf8 Merge pull request #29102 from DougGregor/function-builder-via-constraint-system
[Constraint solver] Use a constraint system to apply all function builders
2020-01-09 23:42:32 -08:00
Doug Gregor
5b320992ea [Constraint solver] Use a constraint system to apply all function builders.
When type checking the body of a function declaration that has a function
builder on it (e.g., `@ViewBuilder var body: some View { ... }`), create a
constraint system that is responsible for constraint generation and
application, sending function declarations through the same code paths
used by closures.
2020-01-09 14:38:45 -08:00
Holly Borla
9ddb5eddc5 Merge pull request #29065 from hborla/subscript-error-diag
[Diagnostics] Finish porting subscript errors
2020-01-08 16:05:04 -08:00
Luciano Almeida
4443966f3d [CSDiagnostics] Removing duplicated diagnose for InstanceType 2020-01-08 07:11:17 -03:00
Luciano Almeida
18f52dcbb0 [CSDiag] Remove visitCoerceExpr from CSDiag 2020-01-08 07:07:48 -03:00
Pavel Yaskevich
66fe1ec2b2 Merge pull request #29053 from xedin/port-ternary-diags
[Diagnostics] Detect and diagnose ternary branch type mismatches
2020-01-08 00:27:32 -08:00
Holly Borla
e26794a11c [CSDiag] Remove diagnoseSubscriptErrors from CSDiag 2020-01-07 17:37:38 -08:00
Holly Borla
42c73334f0 [CSGen] Diagnose subscripting a nil literal in CSGen. 2020-01-07 17:37:38 -08:00
Pavel Yaskevich
be3f949a43 [Diagnostics] Add support for new "ternary branch" element to contextual mismatch 2020-01-07 12:07:02 -08:00
Doug Gregor
d903ca9a9c Merge pull request #29026 from DougGregor/generalize-solution-apply
Generalize solution application
2020-01-06 21:04:55 -08:00
Pavel Yaskevich
36fff23077 Merge pull request #29011 from LucianoPAlmeida/coercion-handle-contextual-mismatch
[Diagnostics] Handle CoerceExpr conversion failure in contextual mismatch
2020-01-06 11:31:12 -08:00
Doug Gregor
dfda7aca7f [Constraint solver] Generalize "target" of solution application.
Chip away at the expression-centric nature of the constraint system by
generalizing the "target" of solution application from a single
expression to a a "SolutionApplicationTarget", which can be an
expression or a function body. The latter will be used for applying
function builders to an entire function body.
2020-01-06 11:31:06 -08:00
Luciano Almeida
d9cfbd3e55 [CSDiag] Remove obsolete code block in visitCoerceExpr 2020-01-05 18:39:55 -03:00
Holly Borla
94bbb8f76e [ConstraintSystem] Finish porting unresolved member reference failures.
This covers member failures where the error is at the declaration, so
the result of member lookup is "already diagnosed".
2020-01-05 11:33:02 -08:00
Holly Borla
475b5591ed Merge pull request #28979 from hborla/ambiguous-call-diagnostics
[ConstraintSystem] Start to allow diagnosing ambiguity with fixes for solution sets with more than one fix.
2020-01-03 08:49:30 -08:00
Holly Borla
9e73bb3176 [ConstraintSystem] Start to allow diagnosing ambiguity with fixes
for solution sets with more than one fix.
2020-01-02 23:48:16 -08:00
Pavel Yaskevich
6261324440 Merge pull request #28980 from xedin/remove-obsolete-csdiag-listener
[CSDiag] NFC: Remove obsolete `CalleeListener` callback
2020-01-02 13:08:15 -08:00
Pavel Yaskevich
43f1e9ba60 [CSDiag] NFC: Remove obsolete CalleeListener callback
Since closure handling has been ported to new diagnostic framework
`CalleeListener` callback is no longer used.
2020-01-02 11:06:09 -08:00
Robert Widmann
ebac915ef4 [NFC] Drop bogus closure interface type reset 2019-12-25 17:03:03 -05:00
Slava Pestov
af07642c8f Sema: Remove TypeCheckExprFlags::SkipMultiStmtClosures
Fold this into TypeCheckExprFlags::SubExpressionDiagnostics, which
is itself going away soon, hopefully!
2019-12-19 23:51:53 -05:00
Pavel Yaskevich
a7bb827b6d [CSDiag] NFC: Remove obsolete diagnoseAmbiguousMultiStatementClosure 2019-12-19 12:17:23 -08:00
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