diff --git a/lib/Sema/CSGen.cpp b/lib/Sema/CSGen.cpp index 8f5118442b6b0..308a97c36d17d 100644 --- a/lib/Sema/CSGen.cpp +++ b/lib/Sema/CSGen.cpp @@ -353,17 +353,6 @@ namespace { } Type visitUnresolvedDeclRefExpr(UnresolvedDeclRefExpr *expr) { - // We might have an operator that couldn't be resolved earlier. - if (expr->getRefKind() != DeclRefKind::Ordinary) { - auto &tc = CS.getTypeChecker(); - tc.diagnose(expr->getLoc(), diag::use_nonmatching_operator, - expr->getName(), - expr->getRefKind() == DeclRefKind::BinaryOperator ? 0 : - expr->getRefKind() == DeclRefKind::PrefixOperator ? 1 : 2); - - return Type(); - } - // This is an error case, where we're trying to use type inference // to help us determine which declaration the user meant to refer to. // FIXME: Do we need to note that we're doing some kind of recovery? diff --git a/lib/Sema/TypeCheckConstraints.cpp b/lib/Sema/TypeCheckConstraints.cpp index 638d673865908..0c0225d1702f3 100644 --- a/lib/Sema/TypeCheckConstraints.cpp +++ b/lib/Sema/TypeCheckConstraints.cpp @@ -326,13 +326,6 @@ static Expr *BindName(UnresolvedDeclRefExpr *UDRE, DeclContext *Context, if (AllDeclRefs) { // Diagnose uses of operators that found no matching candidates. if (ResultValues.empty()) { - // If this is a postfix '*', it might be part of type sugar for - // an unsafe pointer, so delay resolution of this declaration - // reference. - if (UDRE->getRefKind() == DeclRefKind::PostfixOperator && - UDRE->getName().str() == "*") - return UDRE; - assert(UDRE->getRefKind() != DeclRefKind::Ordinary); TC.diagnose(Loc, diag::use_nonmatching_operator, Name, UDRE->getRefKind() == DeclRefKind::BinaryOperator ? 0 : @@ -539,16 +532,6 @@ bool PreCheckExpression::walkToClosureExprPre(ClosureExpr *closure) { return true; } -static bool isAsteriskRef(Expr *E) { - if (auto UDRE = dyn_cast(E)) - return UDRE->getName().str() == "*"; - if (auto DRE = dyn_cast(E)) - return DRE->getDecl()->getName().str() == "*"; - if (auto ODRE = dyn_cast(E)) - return ODRE->getDecls()[0]->getName().str() == "*"; - return false; -} - /// Simplify expressions which are type sugar productions that got parsed /// as expressions due to the parser not knowing which identifiers are /// type names. @@ -596,23 +579,7 @@ TypeExpr *PreCheckExpression::simplifyTypeExpr(Expr *E) { new (TC.Context) OptionalTypeRepr(InnerTypeRepr, QuestionLoc); return new (TC.Context) TypeExpr(TypeLoc(NewTypeRepr, Type())); } - - // Fold T* into an unsafe pointer type with T is a TypeExpr, postfix - // case. - if (auto *PUE = dyn_cast(E)) { - auto *TyExpr = dyn_cast(PUE->getArg()); - if (!TyExpr) return nullptr; - - if (!isAsteriskRef(PUE->getFn())) - return nullptr; - - auto *InnerTypeRepr = TyExpr->getTypeRepr(); - auto *NewTypeRepr - = new (TC.Context) UnsafePointerTypeRepr(InnerTypeRepr, - PUE->getFn()->getLoc()); - return new (TC.Context) TypeExpr(TypeLoc(NewTypeRepr, Type())); - } - + // Fold (T) into a type T with parens around it. if (auto *PE = dyn_cast(E)) { auto *TyExpr = dyn_cast(PE->getSubExpr()); diff --git a/test/type/types.swift b/test/type/types.swift index 5a10fef6a8050..0de6bad563757 100644 --- a/test/type/types.swift +++ b/test/type/types.swift @@ -80,10 +80,4 @@ func test_optional_construct() { var c = (Int?)() // Parenthesized name. } -// postfix * as sugar in expressions, -func test_unsafe_pointer_construct_postfix(t: T) { - var a = T* () - var b = (T*)() -} -// FIXME: * is infix is a delight