mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
1. With overloading in play, SemaDecl should never resolve unqualified lookup that hits at translation unit scope to a DeclRefExpr. Doing so can break overloading.
2. This exposed a bug: when parsing structs, we weren't adding all decls to the translation unit, we were just adding the type alias. 3. This exposed that TypeChecking wasn't handling OneOfElementDecl. 4. Introduce a new NLKind enum in NameLookup instead of passing around a bool. 5. Have unqualified lookup that returns an overload set form a new OverloadSetRefExpr, which has dependent type. 6. Enhance various stuff to handle OverloadSetRefExpr. It's still not fully handled yet though, so it can't be used for anything useful. 7. Change Expr.cpp to print types with << instead of T->print(OS) which is simpler and correct in the face of null. Swift SVN r351
This commit is contained in:
@@ -521,7 +521,7 @@ Decl *Parser::parseDeclOneOf() {
|
||||
/// decl-struct:
|
||||
/// 'struct' attribute-list? identifier type-tuple
|
||||
///
|
||||
Decl *Parser::parseDeclStruct() {
|
||||
bool Parser::parseDeclStruct(llvm::SmallVectorImpl<ExprOrDecl> &Decls) {
|
||||
SMLoc StructLoc = Tok.getLoc();
|
||||
consumeToken(tok::kw_struct);
|
||||
|
||||
@@ -531,19 +531,20 @@ Decl *Parser::parseDeclStruct() {
|
||||
|
||||
Identifier StructName;
|
||||
if (parseIdentifier(StructName, "expected identifier in struct declaration"))
|
||||
return 0;
|
||||
return true;
|
||||
|
||||
Type Ty;
|
||||
if (parseType(Ty)) return 0;
|
||||
if (parseType(Ty)) return true;
|
||||
|
||||
// The type is required to be syntactically a tuple type.
|
||||
if (!llvm::isa<TupleType>(Ty.getPointer())) {
|
||||
error(StructLoc, "element type of struct is not a tuple");
|
||||
// FIXME: Should set this as an erroroneous decl.
|
||||
return 0;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return S.decl.ActOnStructDecl(StructLoc, Attributes, StructName, Ty);
|
||||
S.decl.ActOnStructDecl(StructLoc, Attributes, StructName, Ty, Decls);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1104,7 +1105,7 @@ bool Parser::parseDeclExprList(llvm::SmallVectorImpl<ExprOrDecl> &Entries,
|
||||
Entries.push_back(parseDeclOneOf());
|
||||
break;
|
||||
case tok::kw_struct:
|
||||
Entries.push_back(parseDeclStruct());
|
||||
parseDeclStruct(Entries);
|
||||
break;
|
||||
default:
|
||||
Entries.push_back(ExprOrDecl());
|
||||
|
||||
Reference in New Issue
Block a user