Skip to content

Commit 12b7d90

Browse files
authored
Merge pull request #39443 from Huddie/remove-dyanmic-type-diagnostic
Remove dynamic type diagnostic suggesting using type(of: instead
2 parents caa91db + 15ea425 commit 12b7d90

File tree

2 files changed

+0
-15
lines changed

2 files changed

+0
-15
lines changed

lib/Parse/ParseExpr.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,18 +1144,6 @@ Parser::parseExprPostfixSuffix(ParserResult<Expr> Result, bool isExprBasic,
11441144
continue;
11451145
}
11461146

1147-
// Handle the deprecated 'x.dynamicType' and migrate it to `type(of: x)`
1148-
if (Tok.getText() == "dynamicType") {
1149-
auto range = Result.get()->getSourceRange();
1150-
auto dynamicTypeExprRange = SourceRange(TokLoc, Tok.getLoc());
1151-
diagnose(TokLoc, diag::expr_dynamictype_deprecated)
1152-
.highlight(dynamicTypeExprRange)
1153-
.fixItReplace(dynamicTypeExprRange, ")")
1154-
.fixItInsert(range.Start, "type(of: ");
1155-
1156-
// fallthrough to an UnresolvedDotExpr.
1157-
}
1158-
11591147
// Handle "x.<tab>" for code completion.
11601148
if (Tok.is(tok::code_complete)) {
11611149
assert(!InSwiftKeyPath);

test/Parse/type_expr.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ func unqualifiedType() {
5555

5656
_ = Foo // expected-error{{expected member name or constructor call after type name}} expected-note{{add arguments}} {{10-10=()}} expected-note{{use '.self'}} {{10-10=.self}}
5757
_ = Foo.dynamicType // expected-error {{type 'Foo' has no member 'dynamicType'}}
58-
// expected-error@-1 {{'.dynamicType' is deprecated. Use 'type(of: ...)' instead}} {{7-7=type(of: }} {{10-22=)}}
5958

6059
_ = Bad // expected-error{{expected member name or constructor call after type name}}
6160
// expected-note@-1{{use '.self' to reference the type object}}{{10-10=.self}}
@@ -73,7 +72,6 @@ func qualifiedType() {
7372

7473
_ = Foo.Bar // expected-error{{expected member name or constructor call after type name}} expected-note{{add arguments}} {{14-14=()}} expected-note{{use '.self'}} {{14-14=.self}}
7574
_ = Foo.Bar.dynamicType // expected-error {{type 'Foo.Bar' has no member 'dynamicType'}}
76-
// expected-error@-1 {{'.dynamicType' is deprecated. Use 'type(of: ...)' instead}} {{7-7=type(of: }} {{14-26=)}}
7775
}
7876

7977
// We allow '.Type' in expr context
@@ -112,7 +110,6 @@ func genQualifiedType() {
112110
// expected-note@-1{{add arguments after the type to construct a value of the type}}
113111
// expected-note@-2{{use '.self' to reference the type object}}
114112
_ = Gen<Foo>.Bar.dynamicType // expected-error {{type 'Gen<Foo>.Bar' has no member 'dynamicType'}}
115-
// expected-error@-1 {{'.dynamicType' is deprecated. Use 'type(of: ...)' instead}} {{7-7=type(of: }} {{19-31=)}}
116113
}
117114

118115
func typeOfShadowing() {

0 commit comments

Comments
 (0)