forked from swiftlang/swift
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reapply r31105, with some fixes to invalid unconstrained generics. Th…
…ese fixes correct the regressions that r31105 introduced in the validation tests, as well as fixing a number of other validation tests as well. Introduce a new UnresolvedType to the type system, and have CSDiags start to use it as a way to get more type information out of incorrect subexpressions. UnresolvedType generally just propagates around the type system like a type variable: - it magically conforms to all protocols - it CSGens as an unconstrained type variable. - it ASTPrints as _, just like a type variable. The major difference is that UnresolvedType can be used outside the context of a ConstraintSystem, which is useful for CSGen since it sets up several of them to diagnose subexpressions w.r.t. their types. For now, our use of this is extremely limited: when a closureexpr has no contextual type available and its parameters are invalid, we wipe them out with UnresolvedType (instead of the previous nulltype dance) to get ambiguities later on. We also introduce a new FreeTypeVariableBinding::UnresolvedType approach for constraint solving (and use this only in one place in CSDiags so far, to resolve the callee of a CallExpr) which solves a system and rewrites any leftover type variables as UnresolvedTypes. This allows us to get more precise information out, for example, diagnosing: func r22162441(lines: [String]) { lines.map { line in line.fooBar() } } with: value of type 'String' has no member 'fooBar' instead of: type of expression is ambiguous without more context This improves a number of other diagnostics as well, but is just the infrastructural stepping stone for greater things. Swift SVN r31130
- Loading branch information
Showing
55 changed files
with
219 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.