forked from swiftlang/swift
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix <rdar://problem/23272739> Poor diagnostic due to contextual const…
…raint Previously we erroneously complained: error: cannot invoke 'contains' with an argument list of type '(String)' now we correctly complain: error: unexpected non-void return value in void function This enhances CSDiags to use "getTypeOfMember" when analyzing method candidates that are applied to a known base type. Using it allows us to substitute information about the base, resolving archetypes that exist in subsequent argument positions. In the testcase, this means that we use information about Set<String> to know that the argument to "contains" is a String. This allows us to generate much better diagnostics in some cases, and works around some limitations in the existing stuff for handling unresolved archetypes. One unfortunate change is the notes in Misc/misc_diagnostics.swift. Because we don't track argument lists very well, we are flattening an argument list that is actually ((Int,Int)) into (Int, Int) so we get a bogus looking diagnostic. This was possible before this patch though, it is just one more case that triggers the issue.
- Loading branch information
Showing
5 changed files
with
46 additions
and
10 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