mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Diagnostics] Port name shadowing diagnostics
Diagnose an attempt to reference a top-level name shadowed by
a local member e.g.
```swift
extension Sequence {
func test() -> Int {
return max(1, 2)
}
}
```
Here `min` refers to a global function `min<T>(_: T, _: T)` in `Swift`
module and can only be accessed by adding `Swift.` to it, because `Sequence`
has a member named `min` which accepts a single argument.
This commit is contained in:
@@ -1219,7 +1219,9 @@ AllowNonClassTypeToConvertToAnyObject::create(ConstraintSystem &cs, Type type,
|
||||
}
|
||||
|
||||
bool AddQualifierToAccessTopLevelName::diagnose(bool asNote) const {
|
||||
return false;
|
||||
auto &cs = getConstraintSystem();
|
||||
MissingQuialifierInMemberRefFailure failure(cs, getLocator());
|
||||
return failure.diagnose(asNote);
|
||||
}
|
||||
|
||||
AddQualifierToAccessTopLevelName *
|
||||
|
||||
Reference in New Issue
Block a user