Skip to content

Commit 8d71067

Browse files
committed
[Sema] Fix some walking logic
`walkToTypeReprPost` should return `true` to keep walking, so we really want to check if the `offendingType` hasn't been found yet. Otherwise we'll bail as soon as we visit the first type.
1 parent cedd2c5 commit 8d71067

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

lib/Sema/TypeCheckAccess.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ class TypeAccessScopeDiagnoser : private ASTWalker {
142142

143143
bool walkToTypeReprPost(TypeRepr *T) override {
144144
// Exit early if we've already found a problem type.
145-
return offendingType != nullptr;
145+
return offendingType == nullptr;
146146
}
147147

148148
explicit TypeAccessScopeDiagnoser(AccessScope accessScope,

test/Sema/accessibility_typealias.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public final class ReplayableGenerator<S: Sequence> : IteratorProtocol {
2727
}
2828

2929
struct Generic<T> {
30-
fileprivate typealias Dependent = T
30+
fileprivate typealias Dependent = T // expected-note 2{{type declared here}}
3131
}
3232

3333
var x: Generic<Int>.Dependent = 3 // expected-error {{variable must be declared private or fileprivate because its type uses a fileprivate type}}

test/Sema/availability_compound.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ public struct PublicStruct {
66
public struct Inner {}
77
@available(*, unavailable)
88
internal struct Obsolete {} // expected-note * {{marked unavailable here}}
9+
// expected-note@-1 3{{type declared here}}
910
}
1011

1112
@available(*, unavailable, renamed: "PublicStruct")

0 commit comments

Comments
 (0)