Skip to content

[NFC] Fix issue-61440 test formatting #65454

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 1 commit into from
Apr 27, 2023
Merged
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
54 changes: 22 additions & 32 deletions test/Sema/generic-subscript.swift
Original file line number Diff line number Diff line change
@@ -1,44 +1,34 @@
// RUN: %target-typecheck-verify-swift


protocol P
{
subscript<Value>(x:Value) -> Int // expected-note {{protocol requires subscript with type '<Value> (Value) -> Int'; do you want to add a stub?}}
{
get
}
protocol P {
subscript<Value>(x: Value) -> Int // expected-note {{protocol requires subscript with type '<Value> (Value) -> Int'; do you want to add a stub?}}
{
get
}
}

struct S:P // expected-error {{type 'S' does not conform to protocol 'P'}}
struct S: P // expected-error {{type 'S' does not conform to protocol 'P'}}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not that it really matters but one space before a trailing comment in enough.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for taking on the issue! Line breaks before { are still inconsistent though; could you fix that?

Please consider using more idiomatic and descriptive commit messages. For example, Fix test formatting after #<pull request id>.

Got it, will do in my next PR!

{
subscript<Value>(x:Int) -> Value // expected-note {{candidate has non-matching type '<Value> (Int) -> Value'}}
{
} // expected-error {{missing return in subscript expected to return 'Value'}}
subscript<Value>(x: Int) -> Value // expected-note {{candidate has non-matching type '<Value> (Int) -> Value'}}
{
} // expected-error {{missing return in subscript expected to return 'Value'}}
}



struct S2:P
{
subscript<Value>(x:Value) -> Int
{
return 123;
}
struct S2: P {
subscript<Value>(x: Value) -> Int {
return 123
}
}

protocol P2
{
subscript(x:Int) -> Int
{
get
}
protocol P2 {
subscript(x: Int) -> Int
{
get
}
}

struct S3:P2
{
subscript(x:Int) -> Int
{
return x;
}
struct S3: P2 {
subscript(x: Int) -> Int {
return x
}
}