Files
swift-mirror/test/decl/nested/reserved_name.swift
Pavel Yaskevich 74a8ee177e [Diagnostics] Diagnose missing members via fixes
Try to fix constraint system in a way where member
reference is going to be defined in terms of its use,
which makes it seem like parameters match arguments
exactly. Such helps to produce solutions and diagnose
failures related to missing members precisely.

These changes would be further extended to diagnose use
of unavailable members and other structural member failures.

Resolves: rdar://problem/34583132
Resolves: rdar://problem/36989788
Resolved: rdar://problem/39586166
Resolves: rdar://problem/40537782
Resolves: rdar://problem/46211109
2019-01-09 17:29:49 -08:00

19 lines
461 B
Swift

// RUN: %target-typecheck-verify-swift
struct S1 {
// expected-error @+2 {{type member must not be named 'Type', since it would conflict with the 'foo.Type' expression}}
// expected-note @+1 {{if this name is unavoidable, use backticks to escape it}} {{8-12=`Type`}}
enum Type {
case A
}
}
struct S2 {
enum `Type` {
case A
}
}
let s1: S1.Type = .A // expected-error {{type 'S1.Type' has no member 'A'}}
let s2: S2.`Type` = .A // no-error