Skip to content

Commit 75cf2c1

Browse files
committed
Sema: Remove a usage of replaceCovariantResultType()
1 parent 68f69fa commit 75cf2c1

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

lib/Sema/TypeOfReference.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1483,8 +1483,8 @@ Type ConstraintSystem::getMemberReferenceTypeFromOpenedType(
14831483

14841484
if (auto func = dyn_cast<AbstractFunctionDecl>(value)) {
14851485
if (isa<ConstructorDecl>(func) &&
1486-
!baseObjTy->getOptionalObjectType()) {
1487-
type = type->replaceCovariantResultType(replacementTy, 2);
1486+
func->getDeclContext()->getSelfClassDecl()) {
1487+
type = type->withCovariantResultType();
14881488
}
14891489
}
14901490

test/Constraints/pack-expansion-expressions.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -327,28 +327,28 @@ func test_pack_expansions_with_closures() {
327327
func test_pack_expansion_specialization(tuple: (Int, String, Float)) {
328328
struct Data<each T> {
329329
init(_: repeat each T) {} // expected-note 4 {{'init(_:)' declared here}}
330-
init(vals: repeat each T) {}
331-
init<each U>(x: Int, _: repeat each T, y: repeat each U) {}
330+
init(vals: repeat each T) {} // expected-note {{'init(vals:)' declared here}}
331+
init<each U>(x: Int, _: repeat each T, y: repeat each U) {} // expected-note 3 {{'init(x:_:y:)' declared here}}
332332
}
333333

334334
_ = Data<Int>() // expected-error {{missing argument for parameter #1 in call}}
335335
_ = Data<Int>(0) // Ok
336336
_ = Data<Int, String>(42, "") // Ok
337-
_ = Data<Int>(42, "") // expected-error {{pack expansion requires that 'Int' and 'Int, String' have the same shape}}
337+
_ = Data<Int>(42, "") // expected-error {{extra argument in call}}
338338
_ = Data<Int, String>((42, ""))
339339
// expected-error@-1 {{initializer expects 2 separate arguments; remove extra parentheses to change tuple into separate arguments}} {{25-26=}} {{32-33=}}
340340
_ = Data<Int, String, Float>(vals: (42, "", 0))
341-
// expected-error@-1 {{pack expansion requires that 'Int, String, Float' and '(Int, String, Int)' have the same shape}}
341+
// expected-error@-1 {{initializer expects 3 separate arguments; remove extra parentheses to change tuple into separate arguments}}
342342
_ = Data<Int, String, Float>((vals: 42, "", 0))
343343
// expected-error@-1 {{initializer expects 3 separate arguments; remove extra parentheses to change tuple into separate arguments}} {{32-33=}} {{48-49=}}
344344
_ = Data<Int, String, Float>(tuple)
345345
// expected-error@-1 {{initializer expects 3 separate arguments}}
346346
_ = Data<Int, String, Float>(x: 42, tuple)
347-
// expected-error@-1 {{pack expansion requires that 'Int, String, Float' and '(Int, String, Float)' have the same shape}}
347+
// expected-error@-1 {{missing arguments for parameters #2, #2 in call}}
348348
_ = Data<Int, String, Float>(x: 42, tuple, y: 1, 2, 3)
349-
// expected-error@-1 {{pack expansion requires that 'Int, String, Float' and '(Int, String, Float)' have the same shape}}
349+
// expected-error@-1 {{missing arguments for parameters #2, #2 in call}}
350350
_ = Data<Int, String, Float>(x: 42, (42, "", 0), y: 1, 2, 3)
351-
// expected-error@-1 {{pack expansion requires that 'Int, String, Float' and '(Int, String, Int)' have the same shape}}
351+
// expected-error@-1 {{missing arguments for parameters #2, #2 in call}}
352352

353353
struct Ambiguity<each T> {
354354
func test(_: repeat each T) -> Int { 42 }

test/IDE/complete_init.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ typealias CAlias = C
138138

139139
var CAliasInstance = CAlias(#^ALIAS_CONSTRUCTOR_0^#
140140
// rdar://18586415
141-
// ALIAS_CONSTRUCTOR_0: Decl[Constructor]/CurrNominal/Flair[ArgLabels]: ['(']{#x: A#}[')'][#CAlias#];
142-
// ALIAS_CONSTRUCTOR_0: Decl[Constructor]/CurrNominal/Flair[ArgLabels]: ['(']{#y: A#}[')'][#CAlias#];
141+
// ALIAS_CONSTRUCTOR_0: Decl[Constructor]/CurrNominal/Flair[ArgLabels]: ['(']{#x: A#}[')'][#C#];
142+
// ALIAS_CONSTRUCTOR_0: Decl[Constructor]/CurrNominal/Flair[ArgLabels]: ['(']{#y: A#}[')'][#C#];
143143

144144
// https://github.com/apple/swift/issues/57916
145145
struct Issue57916 {

test/decl/protocol/conforms/typed_throws.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ struct S3: FailureAssociatedType {
6262
func testAssociatedTypes() {
6363
let _ = S1.Failure() // expected-error{{'S1.Failure' (aka 'MyError') cannot be constructed because it has no accessible initializers}}
6464
let _ = S2.Failure() // expected-error{{'S2.Failure' (aka 'any Error') cannot be constructed because it has no accessible initializers}}
65-
let _: Int = S3.Failure() // expected-error{{cannot convert value of type 'S3.Failure' (aka 'Never') to specified type 'Int'}}
65+
let _: Int = S3.Failure() // expected-error{{cannot convert value of type 'Never' to specified type 'Int'}}
6666
// expected-error@-1{{missing argument for parameter 'from' in call}}
6767
}
6868

test/decl/typealias/generic.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ class GenericClass<T> {
178178
}
179179

180180
func testCaptureInvalid1<S>(s: S, t: T) -> TA<Int> {
181-
return TA<S>(a: t, b: s) // expected-error {{cannot convert return expression of type 'GenericClass<T>.TA<S>' (aka 'MyType<T, S>') to return type 'GenericClass<T>.TA<Int>' (aka 'MyType<T, Int>')}}
181+
return TA<S>(a: t, b: s) // expected-error {{cannot convert return expression of type 'MyType<T, S>' to return type 'GenericClass<T>.TA<Int>' (aka 'MyType<T, Int>')}}
182182
}
183183

184184
func testCaptureInvalid2<S>(s: Int, t: T) -> TA<S> {

0 commit comments

Comments
 (0)