Skip to content

[TypeChecker] NFC: Add a test-case for expression affected by rdar://61749633 #37246

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
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
12 changes: 12 additions & 0 deletions test/Constraints/subscript.swift
Original file line number Diff line number Diff line change
Expand Up @@ -216,3 +216,15 @@ func rdar61084565() {
let a = Foo()
a[] // expected-error {{value of type 'Foo' has no subscripts}}
}

func test_subscript_accepts_type_name_argument() {
struct A {
subscript(a: A.Type) -> Int { get { 42 } }
}

func test(a: A?) {
let _ = a?[A] // expected-error {{expected member name or constructor call after type name}}
// expected-note@-1 {{add arguments after the type to construct a value of the type}} {{17-17=()}}
// expected-note@-2 {{use '.self' to reference the type object}} {{17-17=.self}}
}
}