Commit Graph

13 Commits

Author SHA1 Message Date
Hamish Knight
96ae3fdb11 [AST] Look through specializations in getDirectCallee
This results in better recovery and fixes an assertion failure in
cases where we're attempting to diagnose a failure with the call.

rdar://145593552
2025-02-26 10:02:55 +00:00
Greg Titus
d87e049cde Improve diagnoses of generic specializations
Always add constraints, find fixes during simplify.
New separate fix for allow generic function specialization.
Improve parse heuristic for isGenericTypeDisambiguatingToken.
Degrade concrete type specialization fix to warning for macros.
2024-07-30 18:51:34 -07:00
Pavel Yaskevich
0343bb18af Revert "[Sema] Add specialization constraints for func and variable types, then diagnose w/fixes." 2024-07-25 15:43:15 -07:00
Greg Titus
6e917b567a Improve diagnoses of generic specializations
Always add constraints, find fixes during simplify.
New separate fix for allow generic function specialization.
Improve parse heuristic for isGenericTypeDisambiguatingToken.
2024-07-24 14:25:11 -07:00
Anthony Latsis
ff7f117025 Gardening: Migrate test suite to GH issues: Parse 2022-09-02 01:44:24 +03:00
Robert Widmann
0267384e11 Fixup SourceKit and Tests
Patch up all the places that are making a syntactic judgement about the
isInvalid() bit in a ValueDecl.  They may continue to use that query,
but most guard themselves on whether the interface type has been set.
2019-10-30 15:09:14 -07:00
Robert Widmann
742f6b2102 Drastically Simplify VarDecl Validation
This is an amalgam of simplifications to the way VarDecls are checked
and assigned interface types.

First, remove TypeCheckPattern's ability to assign the interface and
contextual types for a given var decl.  Instead, replace it with the
notion of a "naming pattern".  This is the pattern that semantically
binds a given VarDecl into scope, and whose type will be used to compute
the interface type. Note that not all VarDecls have a naming pattern
because they may not be canonical.

Second, remove VarDecl's separate contextual type member, and force the
contextual type to be computed the way it always was: by mapping the
interface type into the parent decl context.

Third, introduce a catch-all diagnostic to properly handle the change in
the way that circularity checking occurs.  This is also motivated by
TypeCheckPattern not being principled about which parts of the AST it
chooses to invalidate, especially the parent pattern and naming patterns
for a given VarDecl.  Once VarDecls are invalidated along with their
parent patterns, a large amount of this diagnostic churn can disappear.
Unfortunately, if this isn't here, we will fail to catch a number of
obviously circular cases and fail to emit a diagnostic.
2019-10-14 12:06:50 -07:00
Robert Widmann
e50713d94e Diagnose misplaced associated values in simple enum patterns 2017-06-09 21:24:28 -07:00
Slava Pestov
76a005587b Sema: Specialization of nested types in expression context
Teach preCheckExpression() about UnresolvedSpecializeExpr
where the base is a TypeExpr.

This allows us to type check expressions like
'[Outer<T>.Inner<U>]()' by folding them down to a TypeExpr
with an array type.
2017-05-21 18:16:16 -07:00
practicalswift
30a88d38e6 [gardening] Fix recently introduced typos 2017-01-06 21:16:02 +01:00
Rintaro Ishizaki
6d477a557f [Tests] Add FIXME test cases for enum-element-pattern with sub pattern 2016-12-21 02:22:48 +09:00
Rintaro Ishizaki
9f43e456f4 [TypeChecker] Add diagnostic with fix-it for specialized enum case pattern in Swift3 mode. 2016-12-21 02:22:20 +09:00
Rintaro Ishizaki
80721e9c30 [TypeChecker] Don't convert specialzed call into EnumElement pattern 2016-12-20 20:21:48 +09:00