Pavel Yaskevich
f68e8d2436
[Diagnostics] Don't diagnose inability to infer closure parameter if contextual couldn't be established
...
If closure is an argument to a call to a missing member or invalid
contextual member reference let's not diagnose problems related to
inability to infer parameter types because root issue is that context
for closure inference couldn't be established.
2020-05-15 01:13:06 -07:00
Pavel Yaskevich
7e4eb9cee5
[Diagnostics] Diagnose inability to infer type of a closure parameter
2020-05-15 01:13:06 -07:00
Luciano Almeida
7c19460d3b
[test] Adding SR-12745 test cases
2020-05-12 17:58:10 -03:00
Luciano Almeida
02c454c976
[Diagnostics] Diagnose that we cannot infer the key path type when binding to a hole
2020-05-11 18:08:40 -03:00
Saleem Abdulrasool
09975d1253
sprinkle llvm_unreachable for covered switches (NFC)
...
Annotate the covered switches with `llvm_unreachable` to avoid the MSVC
warning which does not recognise the covered switches. This allows us
to avoid a spew of warnings.
2020-05-07 11:05:35 -07:00
Artem Chikin
7aed042817
Add fix on Keypath -> Function with multiple arguments type mismatch.
...
When simplifying a keypath constraint with a function type binding, single-parameter functions have the parameter type and the return type matched against the keypath root and value; whereas multiple-parameter functions cause an ambiguous failure (in `simplifyKeyPathConstraint`).
Resolves rdar://problem/57930643
2020-05-06 19:15:08 -07:00
Pavel Yaskevich
1f0ecc6e92
Merge pull request #31511 from LucianoPAlmeida/SR-12725-diagnostics-generic-argument
...
[SR-12725] Diagnose unhandled generic argument mismatch involving FunctionArgument
2020-05-03 00:44:41 -07:00
Luciano Almeida
5ac1926f50
[CSDiagnostics] Break to the fallbacks when no specific diagnostics is found
2020-05-03 02:09:00 -03:00
Pavel Yaskevich
786b16ce82
[Diagnostics] NFC: Switch to which doesn't require constraint system
2020-05-01 14:28:15 -07:00
Pavel Yaskevich
5a7c70dcc4
[Diagnostics] NFC: Add isRawRepresentable/conformsToKnownProtocol helpers into FailureDiagnostic
2020-05-01 13:46:21 -07:00
Pavel Yaskevich
bf4c3b7bdd
[Diagnostics] Use data from associated solution while diagnosing missing generic arguments
2020-05-01 13:04:56 -07:00
Pavel Yaskevich
2d1e408170
[Diagnostics] Use solution for verify presence of fix in diagnoseUseOfReferenceEqualityOperator
2020-05-01 12:52:58 -07:00
Pavel Yaskevich
b405f7c543
[Diagnostics] Avoid direct use of constraint system by MissingArgumentsFailure::isMisplacedMissingArgument
2020-05-01 12:45:48 -07:00
Pavel Yaskevich
db6801b4b5
[Diagnostics] Add getRawType which allows to retrieve type associated with ASTNode
...
This is useful when diagnostic needs to check something about type
variables involved in a particular type e.g. whether type variable
has been defaulted.
2020-05-01 12:44:34 -07:00
Pavel Yaskevich
ee6c228214
[Diagnostics] NFC: Move is{Array, Collection}Type helpers into FailureDiagnostic
2020-05-01 12:21:15 -07:00
Pavel Yaskevich
490548f70b
[Diagnostics] Fix ContextualFailure to use solution data for hasAppliedSelf
2020-05-01 11:02:40 -07:00
Pavel Yaskevich
b4c73abdbc
[Diagnostics] Fix MissingConformanceFailure::diagnoseAsError to use solution to retrieve fixes
2020-05-01 10:55:25 -07:00
Pavel Yaskevich
a05e072a6c
[Diagnostics] Fix RequirementFailure::getConformanceForConditionalReq to use data from solution
2020-05-01 10:52:25 -07:00
Pavel Yaskevich
99ef865aac
[Diagnostics] Switch FailureDiagnostic to use ASTNode instead of TypedNode
2020-04-29 17:03:45 -07:00
Pavel Yaskevich
a400c74c47
Merge pull request #31366 from LucianoPAlmeida/SR-12672-diagnostics
...
[SR-12672] Tailored diagnostics for missing member involving array literal default to any element
2020-04-28 16:10:46 -07:00
Luciano Almeida
723a75343d
[CSDiagnostics] Tailor diagnostic for define missing member when involving a collectin type
2020-04-28 17:07:12 -03:00
Robert Widmann
a6fc9b3679
Merge pull request #31253 from CodaFi/casting-call
...
Strip TypeExpr of its TypeLoc
2020-04-28 09:45:53 -07:00
Luciano Almeida
4f7ad54b5f
[tests] Add tests for SR-12672
2020-04-28 13:07:09 -03:00
Luciano Almeida
041051e1ed
[CSDiagnostics] Tailor diagnostic for define missing member when involves array literal and unresolved member
2020-04-28 12:35:28 -03:00
Slava Pestov
742bd98402
Sema: Remove ConformanceCheckOptions::SkipConditionalRequirements
...
All callers can trivially be refactored to use ModuleDecl::lookupConformance()
instead. Since this was the last flag in ConformanceCheckOptions, we can remove
that, too.
2020-04-25 00:14:24 -04:00
Joe Groff
b4c7a7e85d
Merge pull request #31224 from AnthonyLatsis/rename-getfullname-2
...
AST: Rename getFullName -> getName on ValueDecl & MissingMemberDecl
2020-04-24 12:51:28 -07:00
Robert Widmann
09db2902d2
Strip TypeExpr of its TypeLoc
...
Remove duplication in the modeling of TypeExpr. The type of a TypeExpr
node is always a metatype corresponding to the contextual
type of the type it's referencing. For some reason, the instance type
was also stored in this TypeLoc at random points in semantic analysis.
Under the assumption that this instance type is always going to be the
instance type of the contextual type of the expression, introduce
a number of simplifications:
1) Explicit TypeExpr nodes must be created with a TypeRepr node
2) Implicit TypeExpr nodes must be created with a contextual type
3) The typing rules for implicit TypeExpr simply opens this type
2020-04-23 17:04:38 -07:00
Pavel Yaskevich
9f02f782f3
[Diagnostics] NFC: Switch dyn_cast/get of anchor to either castToExpr or getAsExpr
2020-04-23 01:13:13 -07:00
Pavel Yaskevich
4b1aa29149
[ConstraintSystem] NFC: Adjust all uses of locator anchors to work with TypedNode
2020-04-23 01:13:13 -07:00
Pavel Yaskevich
398f37842a
[ConstraintSystem] Elevate TypedNode access helpers up to the namespace
...
Originally such accessors were only useful for `FailureDiagnostic` but
now since `ConstraintLocator` is anchored with `TypedNode` it makes sense
to make them universally accessible.
2020-04-23 01:13:13 -07:00
Pavel Yaskevich
288e286efd
Merge pull request #31192 from LucianoPAlmeida/SR-12425-diagnostics
...
[SR-12425] Improving diagnostics for key path application on non-convertible root type
2020-04-23 00:17:49 -07:00
Luciano Almeida
721dd7780d
[NFC] Minor comment adjustments
2020-04-22 23:55:58 -03:00
Anthony Latsis
74252028ca
AST: Rename getFullName -> getName on ValueDecl & MissingMemberDecl
2020-04-23 05:16:55 +03:00
Luciano Almeida
094ffd6b25
[CSDiagnostics] Adjusting KeyPathRootTypeMismatchFailure implementation and message
2020-04-22 20:30:54 -03:00
Robert Widmann
78e07c1d41
Merge pull request #31159 from CodaFi/track-star
...
Remove Fallback Infrastructure For Evaluator-Based Dependencies
2020-04-22 15:37:48 -07:00
Luciano Almeida
6e5be5b7d4
[CSDiagnostics] Create KeyPathRootTypeMismatchFailure to diagnose key path root fail on key path application
2020-04-21 17:38:06 -03:00
Robert Widmann
48a5432cb7
[NFC] Remove ConformanceCheckFlags::InExpression
...
The last read of this bit was removed when the legacy referenced name tracker was deleted in the last commit.
2020-04-20 10:22:58 -07:00
Pavel Yaskevich
967b3a3c8d
[Diagnostics] Adjust getCallInfo to accept TypedNode instead of expression
2020-04-17 13:28:06 -07:00
Pavel Yaskevich
4ea7f3bbb1
[Diagnostics] Add helper functions to work with anchors - {castTo, getAs, is}Expr
2020-04-17 13:15:12 -07:00
Pavel Yaskevich
6335a4f2ef
[Diagnostics] Resolve const-ness problems introduced by TypedNode
...
Since `TypedNode` elements are all marked as `const` diagnostics
need to get some of the APIs adjusted to support passing `const Expr *`.
2020-04-17 11:43:09 -07:00
Pavel Yaskevich
08e09fc685
[Diagnostics] Switch getType to use TypedNode
2020-04-17 11:43:09 -07:00
Pavel Yaskevich
66a07bab95
[Diagnostics] Switch getContextualType* to use TypedNode
2020-04-17 11:43:09 -07:00
Pavel Yaskevich
71ab19bdce
[Diagnostics] Switch getConstraintLocator variants to accept TypedNode
2020-04-17 11:43:09 -07:00
Pavel Yaskevich
f5714bf50d
[Diagnostics] Switch get{Raw}Anchor to return TypedNode
...
In preparation to anchor `ConstraintLocator` from `TypedNode`
let's refactor diagnostics (which is the biggest user of locators)
to support `TypedNode` instead of `Expr *`.
2020-04-17 11:43:09 -07:00
Pavel Yaskevich
4ed3665f86
[Diagnostics] Provide anchors on demand instead of storing in FailureDiagnostic
...
This decouples `FailureDiagnostic` from expression.
2020-04-17 11:43:09 -07:00
Pavel Yaskevich
ce324d35bf
[Diagnostics] Missing member diagnostic associated with module should point to name
2020-04-14 13:53:49 -07:00
Pavel Yaskevich
b7489201ff
[Diagnostic] Non-ephemeral pointer init diagnostic should point to .init if present
2020-04-14 13:01:57 -07:00
Pavel Yaskevich
cdee9a1ce3
[Diagnostics] Use new getLoc and getSourceRange methods
...
Split `emitDiagnostic` into `emitDiagnostic` and `emitDiagnosticAt`.
Refactor existing diagnostics to use new methods and avoid passing
location when possible.
2020-04-14 11:30:11 -07:00
Pavel Yaskevich
5dbced972f
[Diagnostics] Allow failure diagnostic implementation to extend getAnchor
...
Some of the diagnostics have special rules about anchor location,
let's make `getAnchor` virtual and allow sub-class to override
default implementation.
2020-04-14 11:30:11 -07:00
Hamish Knight
a61223a255
[CS] Visit all fixed bindings for constraint re-activation ( #30886 )
...
[CS] Visit all fixed bindings for constraint re-activation
2020-04-10 12:27:47 -07:00