Re-sugar the types we deduce for type variables.

This makes us deduce types like "[Int]" and "[String : Int]" from
array/dictionary literals, giving a nicer REPL experience.


Swift SVN r19258
This commit is contained in:
Doug Gregor
2014-06-26 22:04:47 +00:00
parent 12ad12f1b4
commit 39bcf3bd85
4 changed files with 31 additions and 5 deletions

View File

@@ -666,6 +666,12 @@ Type ConstraintSystem::openBindingType(Type type, DeclContext *dc) {
}
}
if (auto dict = isDictionaryType(type)) {
if (auto replacement = getTypeChecker().getDictionaryType(
SourceLoc(), dict->first, dict->second))
return replacement;
}
return result;
}