Skip to content

Gardening: Migrate test suite to GH issues p. 13 #60836

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions test/expr/delayed-ident/enum.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@ var e2b: E2 = .Second(5)
e2b = .First
var e2c: E2 = .First // expected-error{{generic parameter 'T' could not be inferred}}

// SR-13357
struct SR13357 {}
extension Optional where Wrapped == SR13357 {
static var sr13357: Self { .none }
// https://github.com/apple/swift/issues/55797

struct S_55797 {}
extension Optional where Wrapped == S_55797 {
static var v55797: Self { .none }
}

func f_sr13357<T>(_: T?) { }
func f_55797<T>(_: T?) { }

f_sr13357(.sr13357)
f_55797(.v55797)
69 changes: 36 additions & 33 deletions test/expr/delayed-ident/optional_overload.swift
Original file line number Diff line number Diff line change
@@ -1,47 +1,50 @@
// RUN: %target-typecheck-verify-swift -dump-ast > %t.dump
// RUN: %FileCheck %s < %t.dump

// SR-13815
// https://github.com/apple/swift/issues/56212

extension Optional {
func sr13815() -> SR13815? { SR13815() }
static func sr13815_2() -> SR13815? { SR13815() }
static func sr13815_3() -> SR13815? { SR13815() }
static var sr13815_wrongType: Int { 0 }
static var sr13815_overload: SR13815 { SR13815() }
init(overloaded: Void) { self = nil }
func member1() -> S1? {}
static func member2() -> S1? {}
static func member3() -> S1? {}
static var member_wrongType: Int { get {} }
static var member_overload: S1 { get {} }

init(overloaded: Void) {}
}

protocol P1 {}
extension Optional: P1 where Wrapped: Equatable {
static func member4() {}
}

struct SR13815 {
static var sr13815: SR13815? = SR13815()
static var sr13815_2: SR13815? = SR13815()
static var sr13815_wrongType: SR13815? { SR13815() }
static var p_SR13815: SR13815? { SR13815() }
static func sr13815_3() -> SR13815? { SR13815() }
static var sr13815_overload: SR13815? { SR13815() }
struct S1 {
static var member1: S1? = S1()
static var member2: S1? = S1()
static func member3() -> S1? {}
static var member4: S1? { get {} }
static var member_wrongType: S1? { get {} }
static var member_overload: S1? { get {} }

init(overloaded: Void) {}
init?(failable: Void) {}
init() {}
}

protocol P_SR13815 {}
extension Optional: P_SR13815 where Wrapped: Equatable {
static func p_SR13815() {}
}

let _: SR13815? = .sr13815
let _: SR13815? = .sr13815_wrongType
let _: SR13815? = .init()
let _: SR13815? = .sr13815() // expected-error {{instance member 'sr13815' cannot be used on type 'SR13815?'}}
let _: SR13815? = .sr13815_2()
let _: SR13815? = .init(SR13815())
let _: SR13815? = .init(overloaded: ())
let _: S1? = .member1
let _: S1? = .member_wrongType
let _: S1? = .init()
let _: S1? = .member1() // expected-error {{instance member 'member1' cannot be used on type 'S1?'}}
let _: S1? = .member2()
let _: S1? = .init(S1())
let _: S1? = .init(overloaded: ())
// If members exist on Optional and Wrapped, always choose the one on optional
// CHECK: declref_expr {{.*}} location={{.*}}optional_overload.swift:37
// CHECK: declref_expr {{.*}} location={{.*}}optional_overload.swift:40
// CHECK-SAME: decl=optional_overload.(file).Optional extension.init(overloaded:)
let _: SR13815? = .sr13815_overload
let _: S1? = .member_overload
// Should choose the overload from Optional even if the Wrapped overload would otherwise have a better score
// CHECK: member_ref_expr {{.*}} location={{.*}}optional_overload.swift:41
// CHECK-SAME: decl=optional_overload.(file).Optional extension.sr13815_overload
let _: SR13815? = .init(failable: ())
let _: SR13815? = .sr13815_3()
let _: SR13815? = .p_SR13815
// CHECK: member_ref_expr {{.*}} location={{.*}}optional_overload.swift:44
// CHECK-SAME: decl=optional_overload.(file).Optional extension.member_overload
let _: S1? = .init(failable: ())
let _: S1? = .member3()
let _: S1? = .member4
49 changes: 27 additions & 22 deletions test/expr/postfix/dot/dot_keywords.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,58 +39,63 @@ class SE0071Derived : SE0071Base {
}
}

// SR-3043: Diagnostics when accessing deinit
// https://github.com/apple/swift/issues/45633
// Diagnostics when accessing deinit

class SR3043Base {
}
class Base {}

class SR3043Derived: SR3043Base {
class Derived: Base {
deinit {
super.deinit() // expected-error {{deinitializers cannot be accessed}}
}
}

let sr3043 = SR3043Derived()
sr3043.deinit() // expected-error {{deinitializers cannot be accessed}}
sr3043.deinit // expected-error {{deinitializers cannot be accessed}}
SR3043Derived.deinit() // expected-error {{deinitializers cannot be accessed}}
do {
let derived = Derived()
derived.deinit() // expected-error {{deinitializers cannot be accessed}}
derived.deinit // expected-error {{deinitializers cannot be accessed}}
Derived.deinit() // expected-error {{deinitializers cannot be accessed}}
}

// Allow deinit functions in classes

class ClassWithDeinitFunc {
func `deinit`() {
}

func `deinit`(a: SR3043Base) {
func `deinit`(a: Base) {
}
}

let instanceWithDeinitFunc = ClassWithDeinitFunc()
instanceWithDeinitFunc.deinit()
_ = instanceWithDeinitFunc.deinit(a:)
_ = instanceWithDeinitFunc.deinit as () -> Void
SR3043Derived.deinit() // expected-error {{deinitializers cannot be accessed}}
Copy link
Collaborator Author

@AnthonyLatsis AnthonyLatsis Aug 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test case on this line is a dupe (see old line 56)—deleted it.


class ClassWithDeinitMember {
var `deinit`: SR3043Base?
var `deinit`: Base?
}

do {
let instanceWithDeinitFunc = ClassWithDeinitFunc()
instanceWithDeinitFunc.deinit()
_ = instanceWithDeinitFunc.deinit(a:)
_ = instanceWithDeinitFunc.deinit as () -> Void

let instanceWithDeinitMember = ClassWithDeinitMember()
_ = instanceWithDeinitMember.deinit
}

let instanceWithDeinitMember = ClassWithDeinitMember()
_ = instanceWithDeinitMember.deinit

// https://github.com/apple/swift/issues/48285
// Fix variable name in nested static value

// SR-5715 : Fix variable name in nested static value
struct SR5715 {
struct S {
struct A {
struct B {}
}
}

extension SR5715.A.B {
extension S.A.B {
private static let x: Int = 5

func f() -> Int {
return x // expected-error {{static member 'x' cannot be used on instance of type 'SR5715.A.B'}} {{12-12=SR5715.A.B.}}
return x // expected-error {{static member 'x' cannot be used on instance of type 'S.A.B'}} {{12-12=S.A.B.}}
}
}

Expand Down
3 changes: 2 additions & 1 deletion test/expr/postfix/dot/init_ref_delegation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,8 @@ struct MultipleMemberAccesses {
}
}

func sr10670() {
// https://github.com/apple/swift/issues/53069
do {
struct S {
init(_ x: inout String) {} // expected-note {{candidate expects in-out value of type 'String' for parameter #1}}
init(_ x: inout [Int]) {} // expected-note {{candidate expects in-out value of type '[Int]' for parameter #1}}
Expand Down
8 changes: 5 additions & 3 deletions test/expr/primary/keypath/keypath-objc.swift
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,17 @@ func testTypoCorrection() {
let _: String = #keyPath(A.proString) // expected-error {{type 'A' has no member 'proString'}}
}

class SR_10146_1 {
// https://github.com/apple/swift/issues/52548

class C2 {
@objc let b = 1
}

class SR_10146_2: SR_10146_1 {
class C1_52548: C2 {
let a = \AnyObject.b // expected-error {{the root type of a Swift key path cannot be 'AnyObject'}}
}

class SR_10146_3 {
class C2_52548 {
@objc let abc: Int = 1

func doNotCrash() {
Expand Down
47 changes: 24 additions & 23 deletions test/expr/primary/selector/selector.swift
Original file line number Diff line number Diff line change
Expand Up @@ -120,33 +120,34 @@ func testParseErrors4() {
_ = #selector(C1.subscript) // expected-error{{type 'C1' has no member 'subscript'}}
}

// SR-1827

let optionalSel: Selector? = nil

switch optionalSel {
case #selector(C1.method1)?:
break
default:
break
}
// https://github.com/apple/swift/issues/44436
do {
let optionalSel: Selector?

switch optionalSel {
case #selector(C1.method1)?:
break
default:
break
}

@objc class SR1827 {
@objc func bar() {}
}
@objc class C {
@objc func bar() {}
}

switch optionalSel {
case #selector(SR1827.bar):
break
case #selector(SR1827.bar)!: // expected-error{{cannot force unwrap value of non-optional type 'Selector'}}
break
case #selector(SR1827.bar)?:
break
default:
break
switch optionalSel {
case #selector(C.bar):
break
case #selector(C.bar)!: // expected-error{{cannot force unwrap value of non-optional type 'Selector'}}
break
case #selector(C.bar)?:
break
default:
break
}
}

// SR-9391
// https://github.com/apple/swift/issues/51857

protocol SomeProtocol {
func someFunction()
Expand Down
Loading