From 2a48e19ff09f91b31ba9899b202f3e3092a9c4d9 Mon Sep 17 00:00:00 2001 From: Bruno Rocha Date: Sun, 24 May 2020 15:53:13 +0200 Subject: [PATCH 01/50] [SourceKit] Add Effective Scope to Index --- .../index_effective_access_level.swift | 71 +++ ...ndex_effective_access_level.swift.response | 549 ++++++++++++++++++ .../include/SourceKit/Core/LangSupport.h | 1 + .../SourceKit/lib/SwiftLang/SwiftIndexing.cpp | 7 + .../lib/SwiftLang/SwiftLangSupport.cpp | 16 + .../lib/SwiftLang/SwiftLangSupport.h | 2 + .../tools/sourcekitd/lib/API/Requests.cpp | 3 + utils/gyb_sourcekit_support/UIDs.py | 1 + 8 files changed, 650 insertions(+) create mode 100644 test/SourceKit/Indexing/index_effective_access_level.swift create mode 100644 test/SourceKit/Indexing/index_effective_access_level.swift.response diff --git a/test/SourceKit/Indexing/index_effective_access_level.swift b/test/SourceKit/Indexing/index_effective_access_level.swift new file mode 100644 index 0000000000000..c49ef91a9b2bb --- /dev/null +++ b/test/SourceKit/Indexing/index_effective_access_level.swift @@ -0,0 +1,71 @@ +// RUN: %sourcekitd-test -req=index %s -- -Xfrontend -serialize-diagnostics-path -Xfrontend %t.dia %s | %sed_clean > %t.response +// RUN: %diff -u %s.response %t.response + +public enum PublicEn { + case a + case b +} + +enum InternalEn { + case a + case b +} + +fileprivate enum FilePrivateEn { + case a + case b +} + +private enum PrivateEn { + case a + case b +} + +extension PublicEn { + public func puFoo() {} +} + +public extension PublicEn { + func puFooFromPublicExtension() {} +} + +extension InternalEn { + func foo() {} +} + +extension FilePrivateEn { + fileprivate func flPrFoo() {} +} + +fileprivate extension FilePrivateEn { + func flPrFooFromFilePrivateExtension() {} +} + +extension PrivateEn { + private func prFoo() {} +} + +private extension PrivateEn { + func prFooFromPrivateExtension() {} +} + +private struct ScopeReducerStruct { + public func a() {} + func b() {} + fileprivate func c() {} + private func d() {} +} + +public struct ScopeKeeperStruct { + public func a() {} + func b() {} + fileprivate func c() {} + private func d() {} +} + +struct PartialScopeReducerStruct { + public func a() {} + func b() {} + fileprivate func c() {} + private func d() {} +} diff --git a/test/SourceKit/Indexing/index_effective_access_level.swift.response b/test/SourceKit/Indexing/index_effective_access_level.swift.response new file mode 100644 index 0000000000000..4e5e8b4b7a374 --- /dev/null +++ b/test/SourceKit/Indexing/index_effective_access_level.swift.response @@ -0,0 +1,549 @@ +{ + key.dependencies: [ + { + key.kind: source.lang.swift.import.module.swift, + key.name: "Swift", + key.filepath: Swift.swiftmodule, + key.is_system: 1 + } + ], + key.entities: [ + { + key.kind: source.lang.swift.decl.enum, + key.name: "PublicEn", + key.usr: "s:28index_effective_access_level8PublicEnO", + key.line: 4, + key.column: 13, + key.entities: [ + { + key.kind: source.lang.swift.decl.enumelement, + key.name: "a", + key.usr: "s:28index_effective_access_level8PublicEnO1ayA2CmF", + key.line: 5, + key.column: 10, + key.effective_access_level: source.decl.effective_access.public + }, + { + key.kind: source.lang.swift.decl.enumelement, + key.name: "b", + key.usr: "s:28index_effective_access_level8PublicEnO1byA2CmF", + key.line: 6, + key.column: 10, + key.effective_access_level: source.decl.effective_access.public + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.public + } + ], + key.effective_access_level: source.decl.effective_access.public + }, + { + key.kind: source.lang.swift.decl.enum, + key.name: "InternalEn", + key.usr: "s:28index_effective_access_level10InternalEnO", + key.line: 9, + key.column: 6, + key.entities: [ + { + key.kind: source.lang.swift.decl.enumelement, + key.name: "a", + key.usr: "s:28index_effective_access_level10InternalEnO1ayA2CmF", + key.line: 10, + key.column: 10, + key.effective_access_level: source.decl.effective_access.internal + }, + { + key.kind: source.lang.swift.decl.enumelement, + key.name: "b", + key.usr: "s:28index_effective_access_level10InternalEnO1byA2CmF", + key.line: 11, + key.column: 10, + key.effective_access_level: source.decl.effective_access.internal + } + ], + key.effective_access_level: source.decl.effective_access.internal + }, + { + key.kind: source.lang.swift.decl.enum, + key.name: "FilePrivateEn", + key.usr: "s:28index_effective_access_level13FilePrivateEn33_2295DDF1454D6A6D9229E8222CD85214LLO", + key.line: 14, + key.column: 18, + key.entities: [ + { + key.kind: source.lang.swift.decl.enumelement, + key.name: "a", + key.usr: "s:28index_effective_access_level13FilePrivateEn33_2295DDF1454D6A6D9229E8222CD85214LLO1ayA2DmF", + key.line: 15, + key.column: 10, + key.effective_access_level: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.decl.enumelement, + key.name: "b", + key.usr: "s:28index_effective_access_level13FilePrivateEn33_2295DDF1454D6A6D9229E8222CD85214LLO1byA2DmF", + key.line: 16, + key.column: 10, + key.effective_access_level: source.decl.effective_access.fileprivate + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.fileprivate + } + ], + key.effective_access_level: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.decl.enum, + key.name: "PrivateEn", + key.usr: "s:28index_effective_access_level9PrivateEn33_2295DDF1454D6A6D9229E8222CD85214LLO", + key.line: 19, + key.column: 14, + key.entities: [ + { + key.kind: source.lang.swift.decl.enumelement, + key.name: "a", + key.usr: "s:28index_effective_access_level9PrivateEn33_2295DDF1454D6A6D9229E8222CD85214LLO1ayA2DmF", + key.line: 20, + key.column: 10, + key.effective_access_level: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.decl.enumelement, + key.name: "b", + key.usr: "s:28index_effective_access_level9PrivateEn33_2295DDF1454D6A6D9229E8222CD85214LLO1byA2DmF", + key.line: 21, + key.column: 10, + key.effective_access_level: source.decl.effective_access.fileprivate + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.private + } + ], + key.effective_access_level: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.decl.extension.enum, + key.name: "PublicEn", + key.usr: "s:e:s:28index_effective_access_level8PublicEnO5puFooyyF", + key.line: 24, + key.column: 11, + key.entities: [ + { + key.kind: source.lang.swift.ref.enum, + key.name: "PublicEn", + key.usr: "s:28index_effective_access_level8PublicEnO", + key.line: 24, + key.column: 11 + }, + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "puFoo()", + key.usr: "s:28index_effective_access_level8PublicEnO5puFooyyF", + key.line: 25, + key.column: 17, + key.attributes: [ + { + key.attribute: source.decl.attribute.public + } + ], + key.effective_access_level: source.decl.effective_access.public + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.public + } + ] + }, + { + key.kind: source.lang.swift.decl.extension.enum, + key.name: "PublicEn", + key.usr: "s:e:s:28index_effective_access_level8PublicEnO09puFooFromE9ExtensionyyF", + key.line: 28, + key.column: 18, + key.entities: [ + { + key.kind: source.lang.swift.ref.enum, + key.name: "PublicEn", + key.usr: "s:28index_effective_access_level8PublicEnO", + key.line: 28, + key.column: 18 + }, + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "puFooFromPublicExtension()", + key.usr: "s:28index_effective_access_level8PublicEnO09puFooFromE9ExtensionyyF", + key.line: 29, + key.column: 10, + key.effective_access_level: source.decl.effective_access.public + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.public + } + ] + }, + { + key.kind: source.lang.swift.decl.extension.enum, + key.name: "InternalEn", + key.usr: "s:e:s:28index_effective_access_level10InternalEnO3fooyyF", + key.line: 32, + key.column: 11, + key.entities: [ + { + key.kind: source.lang.swift.ref.enum, + key.name: "InternalEn", + key.usr: "s:28index_effective_access_level10InternalEnO", + key.line: 32, + key.column: 11 + }, + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "foo()", + key.usr: "s:28index_effective_access_level10InternalEnO3fooyyF", + key.line: 33, + key.column: 10, + key.effective_access_level: source.decl.effective_access.internal + } + ] + }, + { + key.kind: source.lang.swift.decl.extension.enum, + key.name: "FilePrivateEn", + key.usr: "s:e:s:28index_effective_access_level13FilePrivateEn33_2295DDF1454D6A6D9229E8222CD85214LLO7flPrFooyyF", + key.line: 36, + key.column: 11, + key.entities: [ + { + key.kind: source.lang.swift.ref.enum, + key.name: "FilePrivateEn", + key.usr: "s:28index_effective_access_level13FilePrivateEn33_2295DDF1454D6A6D9229E8222CD85214LLO", + key.line: 36, + key.column: 11 + }, + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "flPrFoo()", + key.usr: "s:28index_effective_access_level13FilePrivateEn33_2295DDF1454D6A6D9229E8222CD85214LLO7flPrFooyyF", + key.line: 37, + key.column: 22, + key.attributes: [ + { + key.attribute: source.decl.attribute.fileprivate + } + ], + key.effective_access_level: source.decl.effective_access.fileprivate + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.fileprivate + } + ] + }, + { + key.kind: source.lang.swift.decl.extension.enum, + key.name: "FilePrivateEn", + key.usr: "s:e:s:28index_effective_access_level13FilePrivateEn33_2295DDF1454D6A6D9229E8222CD85214LLO011flPrFooFromeF9ExtensionyyF", + key.line: 40, + key.column: 23, + key.entities: [ + { + key.kind: source.lang.swift.ref.enum, + key.name: "FilePrivateEn", + key.usr: "s:28index_effective_access_level13FilePrivateEn33_2295DDF1454D6A6D9229E8222CD85214LLO", + key.line: 40, + key.column: 23 + }, + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "flPrFooFromFilePrivateExtension()", + key.usr: "s:28index_effective_access_level13FilePrivateEn33_2295DDF1454D6A6D9229E8222CD85214LLO011flPrFooFromeF9ExtensionyyF", + key.line: 41, + key.column: 10, + key.effective_access_level: source.decl.effective_access.fileprivate + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.fileprivate + } + ] + }, + { + key.kind: source.lang.swift.decl.extension.enum, + key.name: "PrivateEn", + key.usr: "s:e:s:28index_effective_access_level9PrivateEn33_2295DDF1454D6A6D9229E8222CD85214LLO5prFooyyF", + key.line: 44, + key.column: 11, + key.entities: [ + { + key.kind: source.lang.swift.ref.enum, + key.name: "PrivateEn", + key.usr: "s:28index_effective_access_level9PrivateEn33_2295DDF1454D6A6D9229E8222CD85214LLO", + key.line: 44, + key.column: 11 + }, + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "prFoo()", + key.usr: "s:28index_effective_access_level9PrivateEn33_2295DDF1454D6A6D9229E8222CD85214LLO5prFooyyF", + key.line: 45, + key.column: 18, + key.attributes: [ + { + key.attribute: source.decl.attribute.private + } + ], + key.effective_access_level: source.decl.effective_access.less_than_fileprivate + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.private + } + ] + }, + { + key.kind: source.lang.swift.decl.extension.enum, + key.name: "PrivateEn", + key.usr: "s:e:s:28index_effective_access_level9PrivateEn33_2295DDF1454D6A6D9229E8222CD85214LLO09prFooFromE9ExtensionyyF", + key.line: 48, + key.column: 19, + key.entities: [ + { + key.kind: source.lang.swift.ref.enum, + key.name: "PrivateEn", + key.usr: "s:28index_effective_access_level9PrivateEn33_2295DDF1454D6A6D9229E8222CD85214LLO", + key.line: 48, + key.column: 19 + }, + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "prFooFromPrivateExtension()", + key.usr: "s:28index_effective_access_level9PrivateEn33_2295DDF1454D6A6D9229E8222CD85214LLO09prFooFromE9ExtensionyyF", + key.line: 49, + key.column: 10, + key.effective_access_level: source.decl.effective_access.fileprivate + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.private + } + ] + }, + { + key.kind: source.lang.swift.decl.struct, + key.name: "ScopeReducerStruct", + key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV", + key.line: 52, + key.column: 16, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "a()", + key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV1ayyF", + key.line: 53, + key.column: 17, + key.attributes: [ + { + key.attribute: source.decl.attribute.public + } + ], + key.effective_access_level: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "b()", + key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV1byyF", + key.line: 54, + key.column: 10, + key.effective_access_level: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "c()", + key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV1cyyF", + key.line: 55, + key.column: 22, + key.attributes: [ + { + key.attribute: source.decl.attribute.fileprivate + } + ], + key.effective_access_level: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "d()", + key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV1dyyF", + key.line: 56, + key.column: 18, + key.attributes: [ + { + key.attribute: source.decl.attribute.private + } + ], + key.effective_access_level: source.decl.effective_access.less_than_fileprivate + }, + { + key.kind: source.lang.swift.decl.function.constructor, + key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLVADycfc", + key.line: 52, + key.column: 16, + key.is_implicit: 1, + key.effective_access_level: source.decl.effective_access.fileprivate + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.private + } + ], + key.effective_access_level: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.decl.struct, + key.name: "ScopeKeeperStruct", + key.usr: "s:28index_effective_access_level17ScopeKeeperStructV", + key.line: 59, + key.column: 15, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "a()", + key.usr: "s:28index_effective_access_level17ScopeKeeperStructV1ayyF", + key.line: 60, + key.column: 17, + key.attributes: [ + { + key.attribute: source.decl.attribute.public + } + ], + key.effective_access_level: source.decl.effective_access.public + }, + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "b()", + key.usr: "s:28index_effective_access_level17ScopeKeeperStructV1byyF", + key.line: 61, + key.column: 10, + key.effective_access_level: source.decl.effective_access.internal + }, + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "c()", + key.usr: "s:28index_effective_access_level17ScopeKeeperStructV1c33_2295DDF1454D6A6D9229E8222CD85214LLyyF", + key.line: 62, + key.column: 22, + key.attributes: [ + { + key.attribute: source.decl.attribute.fileprivate + } + ], + key.effective_access_level: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "d()", + key.usr: "s:28index_effective_access_level17ScopeKeeperStructV1d33_2295DDF1454D6A6D9229E8222CD85214LLyyF", + key.line: 63, + key.column: 18, + key.attributes: [ + { + key.attribute: source.decl.attribute.private + } + ], + key.effective_access_level: source.decl.effective_access.less_than_fileprivate + }, + { + key.kind: source.lang.swift.decl.function.constructor, + key.usr: "s:28index_effective_access_level17ScopeKeeperStructVACycfc", + key.line: 59, + key.column: 15, + key.is_implicit: 1, + key.effective_access_level: source.decl.effective_access.internal + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.public + } + ], + key.effective_access_level: source.decl.effective_access.public + }, + { + key.kind: source.lang.swift.decl.struct, + key.name: "PartialScopeReducerStruct", + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV", + key.line: 66, + key.column: 8, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "a()", + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV1ayyF", + key.line: 67, + key.column: 17, + key.attributes: [ + { + key.attribute: source.decl.attribute.public + } + ], + key.effective_access_level: source.decl.effective_access.internal + }, + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "b()", + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV1byyF", + key.line: 68, + key.column: 10, + key.effective_access_level: source.decl.effective_access.internal + }, + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "c()", + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV1c33_2295DDF1454D6A6D9229E8222CD85214LLyyF", + key.line: 69, + key.column: 22, + key.attributes: [ + { + key.attribute: source.decl.attribute.fileprivate + } + ], + key.effective_access_level: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "d()", + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV1d33_2295DDF1454D6A6D9229E8222CD85214LLyyF", + key.line: 70, + key.column: 18, + key.attributes: [ + { + key.attribute: source.decl.attribute.private + } + ], + key.effective_access_level: source.decl.effective_access.less_than_fileprivate + }, + { + key.kind: source.lang.swift.decl.function.constructor, + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructVACycfc", + key.line: 66, + key.column: 8, + key.is_implicit: 1, + key.effective_access_level: source.decl.effective_access.internal + } + ], + key.effective_access_level: source.decl.effective_access.internal + } + ] +} diff --git a/tools/SourceKit/include/SourceKit/Core/LangSupport.h b/tools/SourceKit/include/SourceKit/Core/LangSupport.h index a30759b298842..a6b3ce6d47ab6 100644 --- a/tools/SourceKit/include/SourceKit/Core/LangSupport.h +++ b/tools/SourceKit/include/SourceKit/Core/LangSupport.h @@ -51,6 +51,7 @@ struct EntityInfo { unsigned Line = 0; unsigned Column = 0; ArrayRef Attrs; + Optional EffectiveAccessLevel; EntityInfo() = default; }; diff --git a/tools/SourceKit/lib/SwiftLang/SwiftIndexing.cpp b/tools/SourceKit/lib/SwiftLang/SwiftIndexing.cpp index 42ba21b268786..d70f59af7127c 100644 --- a/tools/SourceKit/lib/SwiftLang/SwiftIndexing.cpp +++ b/tools/SourceKit/lib/SwiftLang/SwiftIndexing.cpp @@ -134,6 +134,13 @@ class SKIndexDataConsumer : public IndexDataConsumer { if (!isRef) { uidAttrs = getDeclAttributeUIDs(symbol.decl); info.Attrs = uidAttrs; + if (auto *VD = dyn_cast(symbol.decl)) { + if (symbol.symInfo.Kind != SymbolKind::Extension) { + AccessScope accessScope = VD->getFormalAccessScope(); + UIdent AttrUID = SwiftLangSupport::getUIDForFormalAccessScope(accessScope); + info.EffectiveAccessLevel = AttrUID; + } + } } return func(info); } diff --git a/tools/SourceKit/lib/SwiftLang/SwiftLangSupport.cpp b/tools/SourceKit/lib/SwiftLang/SwiftLangSupport.cpp index 8fea7e661c542..4828be706cafe 100644 --- a/tools/SourceKit/lib/SwiftLang/SwiftLangSupport.cpp +++ b/tools/SourceKit/lib/SwiftLang/SwiftLangSupport.cpp @@ -82,6 +82,10 @@ static UIdent Attr_Setter_FilePrivate("source.decl.attribute.setter_access.filep static UIdent Attr_Setter_Internal("source.decl.attribute.setter_access.internal"); static UIdent Attr_Setter_Public("source.decl.attribute.setter_access.public"); static UIdent Attr_Setter_Open("source.decl.attribute.setter_access.open"); +static UIdent EffectiveAccess_Public("source.decl.effective_access.public"); +static UIdent EffectiveAccess_Internal("source.decl.effective_access.internal"); +static UIdent EffectiveAccess_FilePrivate("source.decl.effective_access.fileprivate"); +static UIdent EffectiveAccess_LessThanFilePrivate("source.decl.effective_access.less_than_fileprivate"); std::unique_ptr SourceKit::createSwiftLangSupport(SourceKit::Context &SKCtx) { @@ -808,6 +812,18 @@ Optional SwiftLangSupport::getUIDForDeclAttribute(const swift::DeclAttri return None; } +UIdent SwiftLangSupport::getUIDForFormalAccessScope(const swift::AccessScope Scope) { + if (Scope.isPublic()) { + return EffectiveAccess_Public; + } else if (Scope.isInternal()) { + return EffectiveAccess_Internal; + } else if (Scope.isFileScope()) { + return EffectiveAccess_FilePrivate; + } else { + return EffectiveAccess_LessThanFilePrivate; + } +} + std::vector SwiftLangSupport::UIDsFromDeclAttributes(const DeclAttributes &Attrs) { std::vector AttrUIDs; diff --git a/tools/SourceKit/lib/SwiftLang/SwiftLangSupport.h b/tools/SourceKit/lib/SwiftLang/SwiftLangSupport.h index ed616892598fb..c80533b175cdc 100644 --- a/tools/SourceKit/lib/SwiftLang/SwiftLangSupport.h +++ b/tools/SourceKit/lib/SwiftLang/SwiftLangSupport.h @@ -383,6 +383,8 @@ class SwiftLangSupport : public LangSupport { static Optional getUIDForDeclAttribute(const swift::DeclAttribute *Attr); + static SourceKit::UIdent getUIDForFormalAccessScope(const swift::AccessScope Scope); + static std::vector UIDsFromDeclAttributes(const swift::DeclAttributes &Attrs); static SourceKit::UIdent getUIDForNameKind(swift::ide::NameKind Kind); diff --git a/tools/SourceKit/tools/sourcekitd/lib/API/Requests.cpp b/tools/SourceKit/tools/sourcekitd/lib/API/Requests.cpp index 46e4ab3d83012..40775236eddc3 100644 --- a/tools/SourceKit/tools/sourcekitd/lib/API/Requests.cpp +++ b/tools/SourceKit/tools/sourcekitd/lib/API/Requests.cpp @@ -1355,6 +1355,9 @@ bool SKIndexingConsumer::startSourceEntity(const EntityInfo &Info) { } } + if (Info.EffectiveAccessLevel) + Elem.set(KeyEffectiveAccessLevel, Info.EffectiveAccessLevel.getValue()); + EntitiesStack.push_back({ Info.Kind, Elem, ResponseBuilder::Array(), ResponseBuilder::Array()}); return true; diff --git a/utils/gyb_sourcekit_support/UIDs.py b/utils/gyb_sourcekit_support/UIDs.py index 974544dbbb111..d00da912af5f2 100644 --- a/utils/gyb_sourcekit_support/UIDs.py +++ b/utils/gyb_sourcekit_support/UIDs.py @@ -183,6 +183,7 @@ def __init__(self, internal_name, external_name): 'key.completion_check_dependency_interval'), KEY('AnnotatedTypename', 'key.annotated.typename'), KEY('CompileOperation', 'key.compile_operation'), + KEY('EffectiveAccessLevel', 'key.effective_access_level'), ] From f000639ccec62c81f98ede5fd862f302884ab7b4 Mon Sep 17 00:00:00 2001 From: Bruno Rocha Date: Mon, 25 May 2020 22:06:10 +0200 Subject: [PATCH 02/50] Improve tests and generate the rest of the output --- .../Inputs/explicit-access/Exported.swift | 1 + .../Inputs/explicit-access/Module.swift | 2 + .../Inputs/implicit-vis/a.index.response | 12 +- .../Inputs/implicit-vis/b.index.response | 12 +- .../Inputs/test_module.index.response | 54 +- test/SourceKit/Indexing/index.swift.response | 288 +- .../index_bad_modulename.swift.response | 9 +- .../Indexing/index_big_array.swift.response | 9 +- .../index_constructors.swift.response | 15 +- .../index_effective_access_level.swift | 172 +- ...ndex_effective_access_level.swift.response | 2432 +++++++++++++++-- .../Indexing/index_enum_case.swift.response | 30 +- .../index_forbid_typecheck.swift.response | 12 +- .../Indexing/index_func_import.swift.response | 3 +- ...ndex_is_test_candidate_objc.swift.response | 51 +- .../Indexing/index_objcMembers.swift.response | 18 +- .../Indexing/index_operators.swift.response | 21 +- .../Indexing/rdar_21602898.swift.response | 9 +- .../SourceKit/Indexing/sr_3815.swift.response | 21 +- .../include/SourceKit/Core/LangSupport.h | 2 +- .../SourceKit/lib/SwiftLang/SwiftIndexing.cpp | 2 +- .../lib/SwiftLang/SwiftLangSupport.cpp | 4 +- .../tools/sourcekitd/lib/API/Requests.cpp | 4 +- utils/gyb_sourcekit_support/UIDs.py | 2 +- 24 files changed, 2741 insertions(+), 444 deletions(-) create mode 100644 test/SourceKit/Indexing/Inputs/explicit-access/Exported.swift create mode 100644 test/SourceKit/Indexing/Inputs/explicit-access/Module.swift diff --git a/test/SourceKit/Indexing/Inputs/explicit-access/Exported.swift b/test/SourceKit/Indexing/Inputs/explicit-access/Exported.swift new file mode 100644 index 0000000000000..9f5bcfecd1473 --- /dev/null +++ b/test/SourceKit/Indexing/Inputs/explicit-access/Exported.swift @@ -0,0 +1 @@ +public class ExportedClass {} diff --git a/test/SourceKit/Indexing/Inputs/explicit-access/Module.swift b/test/SourceKit/Indexing/Inputs/explicit-access/Module.swift new file mode 100644 index 0000000000000..40872cea6ee6f --- /dev/null +++ b/test/SourceKit/Indexing/Inputs/explicit-access/Module.swift @@ -0,0 +1,2 @@ +@_exported import Exported +public class ModuleClass {} diff --git a/test/SourceKit/Indexing/Inputs/implicit-vis/a.index.response b/test/SourceKit/Indexing/Inputs/implicit-vis/a.index.response index 7e206b4966cbd..0c8fa8f5fbaee 100644 --- a/test/SourceKit/Indexing/Inputs/implicit-vis/a.index.response +++ b/test/SourceKit/Indexing/Inputs/implicit-vis/a.index.response @@ -28,7 +28,8 @@ key.line: 2, key.column: 6, key.is_dynamic: 1, - key.is_implicit: 1 + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.accessor.setter, @@ -36,9 +37,11 @@ key.line: 2, key.column: 6, key.is_dynamic: 1, - key.is_implicit: 1 + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.internal } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.ref.class, @@ -47,7 +50,8 @@ key.line: 2, key.column: 9 } - ] + ], + key.effective_access: source.decl.effective_access.internal } ] } diff --git a/test/SourceKit/Indexing/Inputs/implicit-vis/b.index.response b/test/SourceKit/Indexing/Inputs/implicit-vis/b.index.response index 5960c9fdc9048..23af51f23070a 100644 --- a/test/SourceKit/Indexing/Inputs/implicit-vis/b.index.response +++ b/test/SourceKit/Indexing/Inputs/implicit-vis/b.index.response @@ -28,7 +28,8 @@ key.line: 2, key.column: 6, key.is_dynamic: 1, - key.is_implicit: 1 + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.accessor.setter, @@ -36,9 +37,11 @@ key.line: 2, key.column: 6, key.is_dynamic: 1, - key.is_implicit: 1 + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.internal } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.ref.class, @@ -47,7 +50,8 @@ key.line: 2, key.column: 9 } - ] + ], + key.effective_access: source.decl.effective_access.internal } ] } diff --git a/test/SourceKit/Indexing/Inputs/test_module.index.response b/test/SourceKit/Indexing/Inputs/test_module.index.response index 0fd7532830caa..3082457c3f464 100644 --- a/test/SourceKit/Indexing/Inputs/test_module.index.response +++ b/test/SourceKit/Indexing/Inputs/test_module.index.response @@ -25,7 +25,8 @@ { key.kind: source.lang.swift.decl.class, key.name: "Empty", - key.usr: "s:11test_module5EmptyC" + key.usr: "s:11test_module5EmptyC", + key.effective_access: source.decl.effective_access.public }, { key.kind: source.lang.swift.decl.class, @@ -41,15 +42,18 @@ key.kind: source.lang.swift.decl.function.accessor.getter, key.usr: "s:11test_module7TwoIntsC1xSivg", key.is_dynamic: 1, - key.is_implicit: 1 + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.public }, { key.kind: source.lang.swift.decl.function.accessor.setter, key.usr: "s:11test_module7TwoIntsC1xSivs", key.is_dynamic: 1, - key.is_implicit: 1 + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.public } - ] + ], + key.effective_access: source.decl.effective_access.public }, { key.kind: source.lang.swift.decl.var.instance, @@ -60,22 +64,27 @@ key.kind: source.lang.swift.decl.function.accessor.getter, key.usr: "s:11test_module7TwoIntsC1ySivg", key.is_dynamic: 1, - key.is_implicit: 1 + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.public }, { key.kind: source.lang.swift.decl.function.accessor.setter, key.usr: "s:11test_module7TwoIntsC1ySivs", key.is_dynamic: 1, - key.is_implicit: 1 + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.public } - ] + ], + key.effective_access: source.decl.effective_access.public }, { key.kind: source.lang.swift.decl.function.constructor, key.name: "init(a:b:)", - key.usr: "s:11test_module7TwoIntsC1a1bACSi_Sitcfc" + key.usr: "s:11test_module7TwoIntsC1a1bACSi_Sitcfc", + key.effective_access: source.decl.effective_access.public } - ] + ], + key.effective_access: source.decl.effective_access.public }, { key.kind: source.lang.swift.decl.class, @@ -91,22 +100,27 @@ key.kind: source.lang.swift.decl.function.accessor.getter, key.name: "getter:value", key.usr: "s:11test_module16ComputedPropertyC5valueSivg", - key.is_dynamic: 1 + key.is_dynamic: 1, + key.effective_access: source.decl.effective_access.public }, { key.kind: source.lang.swift.decl.function.accessor.setter, key.name: "setter:value", key.usr: "s:11test_module16ComputedPropertyC5valueSivs", - key.is_dynamic: 1 + key.is_dynamic: 1, + key.effective_access: source.decl.effective_access.public } - ] + ], + key.effective_access: source.decl.effective_access.public } - ] + ], + key.effective_access: source.decl.effective_access.public }, { key.kind: source.lang.swift.decl.protocol, key.name: "Prot1", - key.usr: "s:11test_module5Prot1P" + key.usr: "s:11test_module5Prot1P", + key.effective_access: source.decl.effective_access.public }, { key.kind: source.lang.swift.decl.protocol, @@ -118,17 +132,20 @@ key.name: "Prot1", key.usr: "s:11test_module5Prot1P" } - ] + ], + key.effective_access: source.decl.effective_access.public }, { key.kind: source.lang.swift.decl.protocol, key.name: "Prot3", - key.usr: "s:11test_module5Prot3P" + key.usr: "s:11test_module5Prot3P", + key.effective_access: source.decl.effective_access.public }, { key.kind: source.lang.swift.decl.class, key.name: "C2", - key.usr: "s:11test_module2C2C" + key.usr: "s:11test_module2C2C", + key.effective_access: source.decl.effective_access.public }, { key.kind: source.lang.swift.decl.extension.class, @@ -155,7 +172,8 @@ { key.kind: source.lang.swift.decl.function.free, key.name: "globalFunc()", - key.usr: "s:11test_module10globalFuncyyF" + key.usr: "s:11test_module10globalFuncyyF", + key.effective_access: source.decl.effective_access.public }, { key.kind: source.lang.swift.decl.extension.class, diff --git a/test/SourceKit/Indexing/index.swift.response b/test/SourceKit/Indexing/index.swift.response index b81edd4fb070e..c896f17a8918b 100644 --- a/test/SourceKit/Indexing/index.swift.response +++ b/test/SourceKit/Indexing/index.swift.response @@ -20,16 +20,19 @@ key.usr: , key.line: 4, key.column: 5, - key.is_implicit: 1 + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.accessor.setter, key.usr: , key.line: 4, key.column: 5, - key.is_implicit: 1 + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.internal } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.ref.struct, @@ -50,7 +53,8 @@ key.name: "init()", key.usr: , key.line: 7, - key.column: 3 + key.column: 3, + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.var.instance, @@ -65,7 +69,8 @@ key.line: 8, key.column: 7, key.is_dynamic: 1, - key.is_implicit: 1 + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.accessor.setter, @@ -73,9 +78,11 @@ key.line: 8, key.column: 7, key.is_dynamic: 1, - key.is_implicit: 1 + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.internal } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.ref.class, @@ -90,7 +97,8 @@ key.usr: , key.line: 9, key.column: 8, - key.is_dynamic: 1 + key.is_dynamic: 1, + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.method.instance, @@ -121,7 +129,8 @@ key.line: 10, key.column: 45 } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.method.instance, @@ -152,7 +161,8 @@ key.line: 13, key.column: 47 } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.method.class, @@ -160,9 +170,11 @@ key.usr: , key.line: 16, key.column: 14, - key.is_dynamic: 1 + key.is_dynamic: 1, + key.effective_access: source.decl.effective_access.internal } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.operator.infix, @@ -192,7 +204,8 @@ key.line: 19, key.column: 26 } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.struct, @@ -206,23 +219,27 @@ key.name: "meth()", key.usr: , key.line: 24, - key.column: 8 + key.column: 8, + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.method.static, key.name: "smeth()", key.usr: , key.line: 25, - key.column: 15 + key.column: 15, + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.constructor, key.usr: , key.line: 23, key.column: 8, - key.is_implicit: 1 + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.internal } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.enum, @@ -236,9 +253,11 @@ key.name: "EElem", key.usr: , key.line: 29, - key.column: 8 + key.column: 8, + key.effective_access: source.decl.effective_access.internal } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.protocol, @@ -262,9 +281,11 @@ key.line: 33, key.column: 22 } - ] + ], + key.effective_access: source.decl.effective_access.internal } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.free, @@ -373,7 +394,8 @@ key.line: 42, key.column: 14 } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.typealias, @@ -389,7 +411,8 @@ key.line: 47, key.column: 21 } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.extension.class, @@ -436,7 +459,8 @@ key.line: 50, key.column: 19 } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.method.instance, @@ -460,7 +484,8 @@ key.line: 51, key.column: 22 } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.var.instance, @@ -475,9 +500,11 @@ key.usr: , key.line: 52, key.column: 18, - key.is_dynamic: 1 + key.is_dynamic: 1, + key.effective_access: source.decl.effective_access.internal } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.ref.struct, @@ -516,7 +543,8 @@ key.name: "protMeth(_:)", key.usr: } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.ref.class, @@ -542,9 +570,11 @@ { key.attribute: source.decl.attribute.override } - ] + ], + key.effective_access: source.decl.effective_access.internal } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.var.global, @@ -558,16 +588,19 @@ key.usr: , key.line: 57, key.column: 5, - key.is_implicit: 1 + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.accessor.setter, key.usr: , key.line: 57, key.column: 5, - key.is_implicit: 1 + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.internal } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.ref.class, @@ -596,7 +629,8 @@ key.usr: , key.line: 61, key.column: 5, - key.is_dynamic: 1 + key.is_dynamic: 1, + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.accessor.setter, @@ -604,9 +638,11 @@ key.usr: , key.line: 65, key.column: 5, - key.is_dynamic: 1 + key.is_dynamic: 1, + key.effective_access: source.decl.effective_access.internal } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.ref.struct, @@ -628,9 +664,11 @@ key.usr: , key.line: 70, key.column: 22, - key.is_dynamic: 1 + key.is_dynamic: 1, + key.effective_access: source.decl.effective_access.internal } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.ref.struct, @@ -644,9 +682,11 @@ key.usr: , key.line: 59, key.column: 7, - key.is_implicit: 1 + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.internal } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.class, @@ -670,16 +710,19 @@ key.line: 74, key.column: 22 } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.constructor, key.usr: , key.line: 73, key.column: 7, - key.is_implicit: 1 + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.internal } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.class, @@ -750,7 +793,8 @@ { key.attribute: source.decl.attribute.override } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.constructor, @@ -769,9 +813,11 @@ { key.attribute: source.decl.attribute.override } - ] + ], + key.effective_access: source.decl.effective_access.internal } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.class, @@ -793,7 +839,8 @@ key.usr: , key.line: 82, key.column: 5, - key.is_dynamic: 1 + key.is_dynamic: 1, + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.accessor.setter, @@ -811,7 +858,8 @@ key.column: 8, key.receiver_usr: "s:Si" } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.ref.struct, @@ -827,16 +875,19 @@ key.line: 81, key.column: 26 } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.constructor, key.usr: , key.line: 80, key.column: 7, - key.is_implicit: 1 + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.internal } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.free, @@ -949,7 +1000,8 @@ } ] } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.struct, @@ -963,16 +1015,19 @@ key.name: "sfoo()", key.usr: , key.line: 102, - key.column: 8 + key.column: 8, + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.constructor, key.usr: , key.line: 101, key.column: 8, - key.is_implicit: 1 + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.internal } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.var.global, @@ -1002,9 +1057,11 @@ key.line: 107, key.column: 12 } - ] + ], + key.effective_access: source.decl.effective_access.internal } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.ref.struct, @@ -1044,7 +1101,8 @@ key.column: 16, key.receiver_usr: "s:5index2S2V" } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.class, @@ -1059,16 +1117,19 @@ key.usr: , key.line: 116, key.column: 8, - key.is_dynamic: 1 + key.is_dynamic: 1, + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.constructor, key.usr: , key.line: 115, key.column: 7, - key.is_implicit: 1 + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.internal } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.class, @@ -1139,7 +1200,8 @@ { key.attribute: source.decl.attribute.override } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.constructor, @@ -1158,9 +1220,11 @@ { key.attribute: source.decl.attribute.override } - ] + ], + key.effective_access: source.decl.effective_access.internal } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.free, @@ -1207,14 +1271,16 @@ key.column: 5, key.receiver_usr: "s:5index2S2V" } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.method.instance, key.name: "meth()", key.usr: , key.line: 134, - key.column: 8 + key.column: 8, + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.class, @@ -1251,16 +1317,19 @@ { key.attribute: source.decl.attribute.convenience } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.constructor, key.usr: , key.line: 137, key.column: 7, - key.is_implicit: 1 + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.internal } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.class, @@ -1314,7 +1383,8 @@ key.column: 11, key.receiver_usr: "s:5index3CC4C" } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.constructor, @@ -1333,9 +1403,11 @@ { key.attribute: source.decl.attribute.override } - ] + ], + key.effective_access: source.decl.effective_access.internal } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.class, @@ -1349,7 +1421,8 @@ key.name: "init()", key.usr: , key.line: 150, - key.column: 3 + key.column: 3, + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.var.instance, @@ -1364,7 +1437,8 @@ key.line: 151, key.column: 7, key.is_dynamic: 1, - key.is_implicit: 1 + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.accessor.setter, @@ -1372,7 +1446,8 @@ key.line: 151, key.column: 7, key.is_dynamic: 1, - key.is_implicit: 1 + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.accessor.willset, @@ -1388,7 +1463,8 @@ key.line: 153, key.column: 7 } - ] + ], + key.effective_access: source.decl.effective_access.less_than_fileprivate }, { key.kind: source.lang.swift.decl.function.accessor.didset, @@ -1404,9 +1480,11 @@ key.line: 156, key.column: 7 } - ] + ], + key.effective_access: source.decl.effective_access.less_than_fileprivate } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.ref.struct, @@ -1415,7 +1493,8 @@ key.line: 151, key.column: 23 } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.class, @@ -1437,7 +1516,8 @@ key.usr: , key.line: 165, key.column: 5, - key.is_dynamic: 1 + key.is_dynamic: 1, + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.accessor.setter, @@ -1445,16 +1525,19 @@ key.usr: , key.line: 168, key.column: 5, - key.is_dynamic: 1 + key.is_dynamic: 1, + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.accessor.didset, key.name: "didSet:S1", key.usr: , key.line: 170, - key.column: 5 + key.column: 5, + key.effective_access: source.decl.effective_access.less_than_fileprivate } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.ref.struct, @@ -1468,9 +1551,11 @@ key.usr: , key.line: 162, key.column: 7, - key.is_implicit: 1 + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.internal } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.protocol, @@ -1492,7 +1577,8 @@ key.usr: , key.line: 177, key.column: 5, - key.is_dynamic: 1 + key.is_dynamic: 1, + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.accessor.setter, @@ -1500,7 +1586,8 @@ key.usr: , key.line: 178, key.column: 5, - key.is_dynamic: 1 + key.is_dynamic: 1, + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.accessor.getter, @@ -1508,9 +1595,11 @@ key.usr: , key.line: 179, key.column: 5, - key.is_dynamic: 1 + key.is_dynamic: 1, + key.effective_access: source.decl.effective_access.internal } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.ref.struct, @@ -1519,7 +1608,8 @@ key.line: 176, key.column: 11 } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.class, @@ -1533,14 +1623,16 @@ key.usr: , key.line: 184, key.column: 7, - key.is_implicit: 1 + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.internal } ], key.attributes: [ { key.attribute: source.decl.attribute.available } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.class, @@ -1554,14 +1646,16 @@ key.usr: , key.line: 188, key.column: 7, - key.is_implicit: 1 + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.internal } ], key.attributes: [ { key.attribute: source.decl.attribute.available } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.class, @@ -1575,14 +1669,16 @@ key.usr: , key.line: 192, key.column: 7, - key.is_implicit: 1 + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.internal } ], key.attributes: [ { key.attribute: source.decl.attribute.available } - ] + ], + key.effective_access: source.decl.effective_access.internal } ] } diff --git a/test/SourceKit/Indexing/index_bad_modulename.swift.response b/test/SourceKit/Indexing/index_bad_modulename.swift.response index cfa072fec71ae..83f065b827e5a 100644 --- a/test/SourceKit/Indexing/index_bad_modulename.swift.response +++ b/test/SourceKit/Indexing/index_bad_modulename.swift.response @@ -61,16 +61,19 @@ key.usr: "s:4main1vSo8NSObjectCSgvg", key.line: 9, key.column: 5, - key.is_implicit: 1 + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.accessor.setter, key.usr: "s:4main1vSo8NSObjectCSgvs", key.line: 9, key.column: 5, - key.is_implicit: 1 + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.internal } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.ref.class, diff --git a/test/SourceKit/Indexing/index_big_array.swift.response b/test/SourceKit/Indexing/index_big_array.swift.response index 4c7c18feeb99f..10c5e84a14af2 100644 --- a/test/SourceKit/Indexing/index_big_array.swift.response +++ b/test/SourceKit/Indexing/index_big_array.swift.response @@ -20,16 +20,19 @@ key.usr: "s:9big_array15gCubeVertexDataSaySfGvg", key.line: 1, key.column: 5, - key.is_implicit: 1 + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.accessor.setter, key.usr: "s:9big_array15gCubeVertexDataSaySfGvs", key.line: 1, key.column: 5, - key.is_implicit: 1 + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.internal } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.ref.struct, diff --git a/test/SourceKit/Indexing/index_constructors.swift.response b/test/SourceKit/Indexing/index_constructors.swift.response index 2f5bdf7b05495..cfb0ad914539d 100644 --- a/test/SourceKit/Indexing/index_constructors.swift.response +++ b/test/SourceKit/Indexing/index_constructors.swift.response @@ -51,7 +51,8 @@ key.line: 9, key.column: 7, key.is_dynamic: 1, - key.is_implicit: 1 + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.accessor.setter, @@ -59,9 +60,11 @@ key.line: 9, key.column: 7, key.is_dynamic: 1, - key.is_implicit: 1 + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.internal } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.method.instance, @@ -77,9 +80,11 @@ { key.attribute: source.decl.attribute.objc } - ] + ], + key.effective_access: source.decl.effective_access.internal } - ] + ], + key.effective_access: source.decl.effective_access.internal } ] } diff --git a/test/SourceKit/Indexing/index_effective_access_level.swift b/test/SourceKit/Indexing/index_effective_access_level.swift index c49ef91a9b2bb..dc9a0fe1319a2 100644 --- a/test/SourceKit/Indexing/index_effective_access_level.swift +++ b/test/SourceKit/Indexing/index_effective_access_level.swift @@ -1,71 +1,165 @@ -// RUN: %sourcekitd-test -req=index %s -- -Xfrontend -serialize-diagnostics-path -Xfrontend %t.dia %s | %sed_clean > %t.response +// RUN: %empty-directory(%t) +// RUN: %swift -emit-module -o %t/Exported.swiftmodule %S/Inputs/explicit-access/Exported.swift +// RUN: %swift -emit-module -o %t/Module.swiftmodule %S/Inputs/explicit-access/Module.swift -I %t + +// RUN: %sourcekitd-test -req=index %s -- -I %t %s | %sed_clean > %t.response // RUN: %diff -u %s.response %t.response -public enum PublicEn { - case a - case b +public enum PublicEnum { + case publicEnumCase } -enum InternalEn { - case a - case b +enum InternalEnum { + case internalEnumCase } -fileprivate enum FilePrivateEn { - case a - case b +fileprivate enum FilePrivateEnum { + case filePrivateEnumCase } -private enum PrivateEn { - case a - case b +private enum PrivateEnum { + case privateEnumCase } -extension PublicEn { - public func puFoo() {} +extension PublicEnum { + public func publicMethod() {} } -public extension PublicEn { - func puFooFromPublicExtension() {} +public extension PublicEnum { + func methodFromPublicExtension() {} } -extension InternalEn { - func foo() {} +extension InternalEnum { + func internalMethod() {} } -extension FilePrivateEn { - fileprivate func flPrFoo() {} +extension FilePrivateEnum { + fileprivate func filePrivateMethod() {} } -fileprivate extension FilePrivateEn { - func flPrFooFromFilePrivateExtension() {} +fileprivate extension FilePrivateEnum { + func methodFromFilePrivateExtension() {} } -extension PrivateEn { - private func prFoo() {} +extension PrivateEnum { + private func privateMethod() {} } -private extension PrivateEn { - func prFooFromPrivateExtension() {} +private extension PrivateEnum { + func methodFromPrivateExtension() {} } private struct ScopeReducerStruct { - public func a() {} - func b() {} - fileprivate func c() {} - private func d() {} + public init(publicInitializer: Int) {} + init(internalInitializer: Int) {} + fileprivate init(filePrivateInitializer: Int) {} + private init(privateInitializer: Int) {} + + public let publicProperty: Int = 0 + let internalProperty: Int = 0 + fileprivate let filePrivateProperty: Int = 0 + private let privateProperty: Int = 0 + public private(set) var publicPropertyWithPrivateSetter: Int = 0 + + public subscript(publicSubscript: Int) -> Int { return 0 } + subscript(internalSubscript: Int) -> Int { return 0 } + fileprivate subscript(filePrivateSubscript: Int) -> Int { return 0 } + private subscript(privateSubscript: Int) -> Int { return 0 } + + public func publicMethod() {} + func internalMethod() {} + fileprivate func filePrivateMethod() {} + private func privateMethod() {} } public struct ScopeKeeperStruct { - public func a() {} - func b() {} - fileprivate func c() {} - private func d() {} + public init(publicInitializer: Int) {} + init(internalInitializer: Int) {} + fileprivate init(filePrivateInitializer: Int) {} + private init(privateInitializer: Int) {} + + public let publicProperty: Int = 0 + let internalProperty: Int = 0 + fileprivate let filePrivateProperty: Int = 0 + private let privateProperty: Int = 0 + public private(set) var publicPropertyWithPrivateSetter: Int = 0 + + public subscript(publicSubscript: Int) -> Int { return 0 } + subscript(internalSubscript: Int) -> Int { return 0 } + fileprivate subscript(filePrivateSubscript: Int) -> Int { return 0 } + private subscript(privateSubscript: Int) -> Int { return 0 } + + public func publicMethod() {} + func internalMethod() {} + fileprivate func filePrivateMethod() {} + private func privateMethod() {} } struct PartialScopeReducerStruct { - public func a() {} - func b() {} - fileprivate func c() {} - private func d() {} + public init(publicInitializer: Int) {} + init(internalInitializer: Int) {} + fileprivate init(filePrivateInitializer: Int) {} + private init(privateInitializer: Int) {} + + public let publicProperty: Int = 0 + let internalProperty: Int = 0 + fileprivate let filePrivateProperty: Int = 0 + private let privateProperty: Int = 0 + public private(set) var publicPropertyWithPrivateSetter: Int = 0 + + public subscript(publicSubscript: Int) -> Int { return 0 } + subscript(internalSubscript: Int) -> Int { return 0 } + fileprivate subscript(filePrivateSubscript: Int) -> Int { return 0 } + private subscript(privateSubscript: Int) -> Int { return 0 } + + public func publicMethod() {} + func internalMethod() {} + fileprivate func filePrivateMethod() {} + private func privateMethod() {} +} + +private extension PrivateEnum { + private func privateMethodFromPrivateExtension() {} +} + +public protocol PublicProtocol { + var member: Int { get set } + func method() +} + +protocol InternalProtocol { + var member: Int { get set } + func method() +} + +fileprivate protocol FilePrivateProtocol { + var member: Int { get set } + func method() +} + +private protocol PrivateProtocol { + var member: Int { get set } + func method() +} + +fileprivate struct FilePrivateImplementationOfPublicProtocol: PublicProtocol { + fileprivate var member: Int = 0 + fileprivate func method() {} +} + +open class OpenClass { + open var openProperty: Int { return 0 } + public var publicProperty: Int { return 0 } + var internalProperty: Int { return 0 } + + open func openMethod() {} + public func publicMethod() {} + func internalMethod() {} +} + +import Module + +struct InternalStruct { + let propertyReferencingPublicClassFromModule: Module.ModuleClass + let propertyReferencingPublicClassFromExportedModule: Exported.ExportedClass } diff --git a/test/SourceKit/Indexing/index_effective_access_level.swift.response b/test/SourceKit/Indexing/index_effective_access_level.swift.response index 4e5e8b4b7a374..221e27418219b 100644 --- a/test/SourceKit/Indexing/index_effective_access_level.swift.response +++ b/test/SourceKit/Indexing/index_effective_access_level.swift.response @@ -5,31 +5,69 @@ key.name: "Swift", key.filepath: Swift.swiftmodule, key.is_system: 1 + }, + { + key.kind: source.lang.swift.import.module.swift, + key.name: "Module", + key.filepath: Module.swiftmodule, + key.dependencies: [ + { + key.kind: source.lang.swift.import.module.swift, + key.name: "Exported", + key.filepath: Exported.swiftmodule, + key.dependencies: [ + { + key.kind: source.lang.swift.import.module.swift, + key.name: "Swift", + key.filepath: Swift.swiftmodule, + key.is_system: 1 + }, + { + key.kind: source.lang.swift.import.module.swift, + key.name: "SwiftOnoneSupport", + key.filepath: SwiftOnoneSupport.swiftmodule, + key.is_system: 1, + key.dependencies: [ + { + key.kind: source.lang.swift.import.module.swift, + key.name: "Swift", + key.filepath: Swift.swiftmodule, + key.is_system: 1 + } + ] + } + ] + }, + { + key.kind: source.lang.swift.import.module.swift, + key.name: "Swift", + key.filepath: Swift.swiftmodule, + key.is_system: 1 + }, + { + key.kind: source.lang.swift.import.module.swift, + key.name: "SwiftOnoneSupport", + key.filepath: SwiftOnoneSupport.swiftmodule, + key.is_system: 1 + } + ] } ], key.entities: [ { key.kind: source.lang.swift.decl.enum, - key.name: "PublicEn", - key.usr: "s:28index_effective_access_level8PublicEnO", - key.line: 4, + key.name: "PublicEnum", + key.usr: "s:28index_effective_access_level10PublicEnumO", + key.line: 8, key.column: 13, key.entities: [ { key.kind: source.lang.swift.decl.enumelement, - key.name: "a", - key.usr: "s:28index_effective_access_level8PublicEnO1ayA2CmF", - key.line: 5, - key.column: 10, - key.effective_access_level: source.decl.effective_access.public - }, - { - key.kind: source.lang.swift.decl.enumelement, - key.name: "b", - key.usr: "s:28index_effective_access_level8PublicEnO1byA2CmF", - key.line: 6, + key.name: "publicEnumCase", + key.usr: "s:28index_effective_access_level10PublicEnumO06publicF4CaseyA2CmF", + key.line: 9, key.column: 10, - key.effective_access_level: source.decl.effective_access.public + key.effective_access: source.decl.effective_access.public } ], key.attributes: [ @@ -37,56 +75,40 @@ key.attribute: source.decl.attribute.public } ], - key.effective_access_level: source.decl.effective_access.public + key.effective_access: source.decl.effective_access.public }, { key.kind: source.lang.swift.decl.enum, - key.name: "InternalEn", - key.usr: "s:28index_effective_access_level10InternalEnO", - key.line: 9, + key.name: "InternalEnum", + key.usr: "s:28index_effective_access_level12InternalEnumO", + key.line: 12, key.column: 6, key.entities: [ { key.kind: source.lang.swift.decl.enumelement, - key.name: "a", - key.usr: "s:28index_effective_access_level10InternalEnO1ayA2CmF", - key.line: 10, - key.column: 10, - key.effective_access_level: source.decl.effective_access.internal - }, - { - key.kind: source.lang.swift.decl.enumelement, - key.name: "b", - key.usr: "s:28index_effective_access_level10InternalEnO1byA2CmF", - key.line: 11, + key.name: "internalEnumCase", + key.usr: "s:28index_effective_access_level12InternalEnumO08internalF4CaseyA2CmF", + key.line: 13, key.column: 10, - key.effective_access_level: source.decl.effective_access.internal + key.effective_access: source.decl.effective_access.internal } ], - key.effective_access_level: source.decl.effective_access.internal + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.enum, - key.name: "FilePrivateEn", - key.usr: "s:28index_effective_access_level13FilePrivateEn33_2295DDF1454D6A6D9229E8222CD85214LLO", - key.line: 14, + key.name: "FilePrivateEnum", + key.usr: "s:28index_effective_access_level15FilePrivateEnum33_2295DDF1454D6A6D9229E8222CD85214LLO", + key.line: 16, key.column: 18, key.entities: [ { key.kind: source.lang.swift.decl.enumelement, - key.name: "a", - key.usr: "s:28index_effective_access_level13FilePrivateEn33_2295DDF1454D6A6D9229E8222CD85214LLO1ayA2DmF", - key.line: 15, - key.column: 10, - key.effective_access_level: source.decl.effective_access.fileprivate - }, - { - key.kind: source.lang.swift.decl.enumelement, - key.name: "b", - key.usr: "s:28index_effective_access_level13FilePrivateEn33_2295DDF1454D6A6D9229E8222CD85214LLO1byA2DmF", - key.line: 16, + key.name: "filePrivateEnumCase", + key.usr: "s:28index_effective_access_level15FilePrivateEnum33_2295DDF1454D6A6D9229E8222CD85214LLO04filefG4CaseyA2DmF", + key.line: 17, key.column: 10, - key.effective_access_level: source.decl.effective_access.fileprivate + key.effective_access: source.decl.effective_access.fileprivate } ], key.attributes: [ @@ -94,30 +116,22 @@ key.attribute: source.decl.attribute.fileprivate } ], - key.effective_access_level: source.decl.effective_access.fileprivate + key.effective_access: source.decl.effective_access.fileprivate }, { key.kind: source.lang.swift.decl.enum, - key.name: "PrivateEn", - key.usr: "s:28index_effective_access_level9PrivateEn33_2295DDF1454D6A6D9229E8222CD85214LLO", - key.line: 19, + key.name: "PrivateEnum", + key.usr: "s:28index_effective_access_level11PrivateEnum33_2295DDF1454D6A6D9229E8222CD85214LLO", + key.line: 20, key.column: 14, key.entities: [ { key.kind: source.lang.swift.decl.enumelement, - key.name: "a", - key.usr: "s:28index_effective_access_level9PrivateEn33_2295DDF1454D6A6D9229E8222CD85214LLO1ayA2DmF", - key.line: 20, - key.column: 10, - key.effective_access_level: source.decl.effective_access.fileprivate - }, - { - key.kind: source.lang.swift.decl.enumelement, - key.name: "b", - key.usr: "s:28index_effective_access_level9PrivateEn33_2295DDF1454D6A6D9229E8222CD85214LLO1byA2DmF", + key.name: "privateEnumCase", + key.usr: "s:28index_effective_access_level11PrivateEnum33_2295DDF1454D6A6D9229E8222CD85214LLO07privateF4CaseyA2DmF", key.line: 21, key.column: 10, - key.effective_access_level: source.decl.effective_access.fileprivate + key.effective_access: source.decl.effective_access.fileprivate } ], key.attributes: [ @@ -125,26 +139,26 @@ key.attribute: source.decl.attribute.private } ], - key.effective_access_level: source.decl.effective_access.fileprivate + key.effective_access: source.decl.effective_access.fileprivate }, { key.kind: source.lang.swift.decl.extension.enum, - key.name: "PublicEn", - key.usr: "s:e:s:28index_effective_access_level8PublicEnO5puFooyyF", + key.name: "PublicEnum", + key.usr: "s:e:s:28index_effective_access_level10PublicEnumO12publicMethodyyF", key.line: 24, key.column: 11, key.entities: [ { key.kind: source.lang.swift.ref.enum, - key.name: "PublicEn", - key.usr: "s:28index_effective_access_level8PublicEnO", + key.name: "PublicEnum", + key.usr: "s:28index_effective_access_level10PublicEnumO", key.line: 24, key.column: 11 }, { key.kind: source.lang.swift.decl.function.method.instance, - key.name: "puFoo()", - key.usr: "s:28index_effective_access_level8PublicEnO5puFooyyF", + key.name: "publicMethod()", + key.usr: "s:28index_effective_access_level10PublicEnumO12publicMethodyyF", key.line: 25, key.column: 17, key.attributes: [ @@ -152,7 +166,7 @@ key.attribute: source.decl.attribute.public } ], - key.effective_access_level: source.decl.effective_access.public + key.effective_access: source.decl.effective_access.public } ], key.attributes: [ @@ -163,25 +177,25 @@ }, { key.kind: source.lang.swift.decl.extension.enum, - key.name: "PublicEn", - key.usr: "s:e:s:28index_effective_access_level8PublicEnO09puFooFromE9ExtensionyyF", + key.name: "PublicEnum", + key.usr: "s:e:s:28index_effective_access_level10PublicEnumO010methodFromE9ExtensionyyF", key.line: 28, key.column: 18, key.entities: [ { key.kind: source.lang.swift.ref.enum, - key.name: "PublicEn", - key.usr: "s:28index_effective_access_level8PublicEnO", + key.name: "PublicEnum", + key.usr: "s:28index_effective_access_level10PublicEnumO", key.line: 28, key.column: 18 }, { key.kind: source.lang.swift.decl.function.method.instance, - key.name: "puFooFromPublicExtension()", - key.usr: "s:28index_effective_access_level8PublicEnO09puFooFromE9ExtensionyyF", + key.name: "methodFromPublicExtension()", + key.usr: "s:28index_effective_access_level10PublicEnumO010methodFromE9ExtensionyyF", key.line: 29, key.column: 10, - key.effective_access_level: source.decl.effective_access.public + key.effective_access: source.decl.effective_access.public } ], key.attributes: [ @@ -192,46 +206,46 @@ }, { key.kind: source.lang.swift.decl.extension.enum, - key.name: "InternalEn", - key.usr: "s:e:s:28index_effective_access_level10InternalEnO3fooyyF", + key.name: "InternalEnum", + key.usr: "s:e:s:28index_effective_access_level12InternalEnumO14internalMethodyyF", key.line: 32, key.column: 11, key.entities: [ { key.kind: source.lang.swift.ref.enum, - key.name: "InternalEn", - key.usr: "s:28index_effective_access_level10InternalEnO", + key.name: "InternalEnum", + key.usr: "s:28index_effective_access_level12InternalEnumO", key.line: 32, key.column: 11 }, { key.kind: source.lang.swift.decl.function.method.instance, - key.name: "foo()", - key.usr: "s:28index_effective_access_level10InternalEnO3fooyyF", + key.name: "internalMethod()", + key.usr: "s:28index_effective_access_level12InternalEnumO14internalMethodyyF", key.line: 33, key.column: 10, - key.effective_access_level: source.decl.effective_access.internal + key.effective_access: source.decl.effective_access.internal } ] }, { key.kind: source.lang.swift.decl.extension.enum, - key.name: "FilePrivateEn", - key.usr: "s:e:s:28index_effective_access_level13FilePrivateEn33_2295DDF1454D6A6D9229E8222CD85214LLO7flPrFooyyF", + key.name: "FilePrivateEnum", + key.usr: "s:e:s:28index_effective_access_level15FilePrivateEnum33_2295DDF1454D6A6D9229E8222CD85214LLO04fileF6MethodyyF", key.line: 36, key.column: 11, key.entities: [ { key.kind: source.lang.swift.ref.enum, - key.name: "FilePrivateEn", - key.usr: "s:28index_effective_access_level13FilePrivateEn33_2295DDF1454D6A6D9229E8222CD85214LLO", + key.name: "FilePrivateEnum", + key.usr: "s:28index_effective_access_level15FilePrivateEnum33_2295DDF1454D6A6D9229E8222CD85214LLO", key.line: 36, key.column: 11 }, { key.kind: source.lang.swift.decl.function.method.instance, - key.name: "flPrFoo()", - key.usr: "s:28index_effective_access_level13FilePrivateEn33_2295DDF1454D6A6D9229E8222CD85214LLO7flPrFooyyF", + key.name: "filePrivateMethod()", + key.usr: "s:28index_effective_access_level15FilePrivateEnum33_2295DDF1454D6A6D9229E8222CD85214LLO04fileF6MethodyyF", key.line: 37, key.column: 22, key.attributes: [ @@ -239,7 +253,7 @@ key.attribute: source.decl.attribute.fileprivate } ], - key.effective_access_level: source.decl.effective_access.fileprivate + key.effective_access: source.decl.effective_access.fileprivate } ], key.attributes: [ @@ -250,25 +264,25 @@ }, { key.kind: source.lang.swift.decl.extension.enum, - key.name: "FilePrivateEn", - key.usr: "s:e:s:28index_effective_access_level13FilePrivateEn33_2295DDF1454D6A6D9229E8222CD85214LLO011flPrFooFromeF9ExtensionyyF", + key.name: "FilePrivateEnum", + key.usr: "s:e:s:28index_effective_access_level15FilePrivateEnum33_2295DDF1454D6A6D9229E8222CD85214LLO010methodFromeF9ExtensionyyF", key.line: 40, key.column: 23, key.entities: [ { key.kind: source.lang.swift.ref.enum, - key.name: "FilePrivateEn", - key.usr: "s:28index_effective_access_level13FilePrivateEn33_2295DDF1454D6A6D9229E8222CD85214LLO", + key.name: "FilePrivateEnum", + key.usr: "s:28index_effective_access_level15FilePrivateEnum33_2295DDF1454D6A6D9229E8222CD85214LLO", key.line: 40, key.column: 23 }, { key.kind: source.lang.swift.decl.function.method.instance, - key.name: "flPrFooFromFilePrivateExtension()", - key.usr: "s:28index_effective_access_level13FilePrivateEn33_2295DDF1454D6A6D9229E8222CD85214LLO011flPrFooFromeF9ExtensionyyF", + key.name: "methodFromFilePrivateExtension()", + key.usr: "s:28index_effective_access_level15FilePrivateEnum33_2295DDF1454D6A6D9229E8222CD85214LLO010methodFromeF9ExtensionyyF", key.line: 41, key.column: 10, - key.effective_access_level: source.decl.effective_access.fileprivate + key.effective_access: source.decl.effective_access.fileprivate } ], key.attributes: [ @@ -279,22 +293,22 @@ }, { key.kind: source.lang.swift.decl.extension.enum, - key.name: "PrivateEn", - key.usr: "s:e:s:28index_effective_access_level9PrivateEn33_2295DDF1454D6A6D9229E8222CD85214LLO5prFooyyF", + key.name: "PrivateEnum", + key.usr: "s:e:s:28index_effective_access_level11PrivateEnum33_2295DDF1454D6A6D9229E8222CD85214LLO13privateMethodyyF", key.line: 44, key.column: 11, key.entities: [ { key.kind: source.lang.swift.ref.enum, - key.name: "PrivateEn", - key.usr: "s:28index_effective_access_level9PrivateEn33_2295DDF1454D6A6D9229E8222CD85214LLO", + key.name: "PrivateEnum", + key.usr: "s:28index_effective_access_level11PrivateEnum33_2295DDF1454D6A6D9229E8222CD85214LLO", key.line: 44, key.column: 11 }, { key.kind: source.lang.swift.decl.function.method.instance, - key.name: "prFoo()", - key.usr: "s:28index_effective_access_level9PrivateEn33_2295DDF1454D6A6D9229E8222CD85214LLO5prFooyyF", + key.name: "privateMethod()", + key.usr: "s:28index_effective_access_level11PrivateEnum33_2295DDF1454D6A6D9229E8222CD85214LLO13privateMethodyyF", key.line: 45, key.column: 18, key.attributes: [ @@ -302,7 +316,7 @@ key.attribute: source.decl.attribute.private } ], - key.effective_access_level: source.decl.effective_access.less_than_fileprivate + key.effective_access: source.decl.effective_access.less_than_fileprivate } ], key.attributes: [ @@ -313,25 +327,25 @@ }, { key.kind: source.lang.swift.decl.extension.enum, - key.name: "PrivateEn", - key.usr: "s:e:s:28index_effective_access_level9PrivateEn33_2295DDF1454D6A6D9229E8222CD85214LLO09prFooFromE9ExtensionyyF", + key.name: "PrivateEnum", + key.usr: "s:e:s:28index_effective_access_level11PrivateEnum33_2295DDF1454D6A6D9229E8222CD85214LLO010methodFromE9ExtensionyyF", key.line: 48, key.column: 19, key.entities: [ { key.kind: source.lang.swift.ref.enum, - key.name: "PrivateEn", - key.usr: "s:28index_effective_access_level9PrivateEn33_2295DDF1454D6A6D9229E8222CD85214LLO", + key.name: "PrivateEnum", + key.usr: "s:28index_effective_access_level11PrivateEnum33_2295DDF1454D6A6D9229E8222CD85214LLO", key.line: 48, key.column: 19 }, { key.kind: source.lang.swift.decl.function.method.instance, - key.name: "prFooFromPrivateExtension()", - key.usr: "s:28index_effective_access_level9PrivateEn33_2295DDF1454D6A6D9229E8222CD85214LLO09prFooFromE9ExtensionyyF", + key.name: "methodFromPrivateExtension()", + key.usr: "s:28index_effective_access_level11PrivateEnum33_2295DDF1454D6A6D9229E8222CD85214LLO010methodFromE9ExtensionyyF", key.line: 49, key.column: 10, - key.effective_access_level: source.decl.effective_access.fileprivate + key.effective_access: source.decl.effective_access.fileprivate } ], key.attributes: [ @@ -348,202 +362,2198 @@ key.column: 16, key.entities: [ { - key.kind: source.lang.swift.decl.function.method.instance, - key.name: "a()", - key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV1ayyF", + key.kind: source.lang.swift.decl.function.constructor, + key.name: "init(publicInitializer:)", + key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV17publicInitializerADSi_tcfc", key.line: 53, - key.column: 17, + key.column: 12, + key.entities: [ + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 53, + key.column: 36 + } + ], key.attributes: [ { key.attribute: source.decl.attribute.public } ], - key.effective_access_level: source.decl.effective_access.fileprivate + key.effective_access: source.decl.effective_access.fileprivate }, { - key.kind: source.lang.swift.decl.function.method.instance, - key.name: "b()", - key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV1byyF", + key.kind: source.lang.swift.decl.function.constructor, + key.name: "init(internalInitializer:)", + key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV19internalInitializerADSi_tcfc", key.line: 54, - key.column: 10, - key.effective_access_level: source.decl.effective_access.fileprivate + key.column: 5, + key.entities: [ + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 54, + key.column: 31 + } + ], + key.effective_access: source.decl.effective_access.fileprivate }, { - key.kind: source.lang.swift.decl.function.method.instance, - key.name: "c()", - key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV1cyyF", + key.kind: source.lang.swift.decl.function.constructor, + key.name: "init(filePrivateInitializer:)", + key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV22filePrivateInitializerADSi_tcfc", key.line: 55, - key.column: 22, + key.column: 17, + key.entities: [ + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 55, + key.column: 46 + } + ], key.attributes: [ { key.attribute: source.decl.attribute.fileprivate } ], - key.effective_access_level: source.decl.effective_access.fileprivate + key.effective_access: source.decl.effective_access.fileprivate }, { - key.kind: source.lang.swift.decl.function.method.instance, - key.name: "d()", - key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV1dyyF", + key.kind: source.lang.swift.decl.function.constructor, + key.name: "init(privateInitializer:)", + key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV18privateInitializerADSi_tcfc", key.line: 56, - key.column: 18, + key.column: 13, + key.entities: [ + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 56, + key.column: 38 + } + ], key.attributes: [ { key.attribute: source.decl.attribute.private } ], - key.effective_access_level: source.decl.effective_access.less_than_fileprivate + key.effective_access: source.decl.effective_access.less_than_fileprivate }, { - key.kind: source.lang.swift.decl.function.constructor, - key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLVADycfc", - key.line: 52, + key.kind: source.lang.swift.decl.var.instance, + key.name: "publicProperty", + key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV14publicPropertySivp", + key.line: 58, key.column: 16, - key.is_implicit: 1, - key.effective_access_level: source.decl.effective_access.fileprivate - } - ], - key.attributes: [ + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV14publicPropertySivg", + key.line: 58, + key.column: 16, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.public + } + ], + key.effective_access: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.decl.function.accessor.setter, + key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV14publicPropertySivs", + key.line: 58, + key.column: 16, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.public + } + ], + key.effective_access: source.decl.effective_access.fileprivate + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.public + } + ], + key.effective_access: source.decl.effective_access.fileprivate + }, { - key.attribute: source.decl.attribute.private - } - ], - key.effective_access_level: source.decl.effective_access.fileprivate - }, - { - key.kind: source.lang.swift.decl.struct, - key.name: "ScopeKeeperStruct", - key.usr: "s:28index_effective_access_level17ScopeKeeperStructV", - key.line: 59, - key.column: 15, - key.entities: [ + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 58, + key.column: 32 + }, { - key.kind: source.lang.swift.decl.function.method.instance, - key.name: "a()", - key.usr: "s:28index_effective_access_level17ScopeKeeperStructV1ayyF", + key.kind: source.lang.swift.decl.var.instance, + key.name: "internalProperty", + key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV16internalPropertySivp", + key.line: 59, + key.column: 9, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV16internalPropertySivg", + key.line: 59, + key.column: 9, + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.decl.function.accessor.setter, + key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV16internalPropertySivs", + key.line: 59, + key.column: 9, + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.fileprivate + } + ], + key.effective_access: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 59, + key.column: 27 + }, + { + key.kind: source.lang.swift.decl.var.instance, + key.name: "filePrivateProperty", + key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV19filePrivatePropertySivp", + key.line: 60, + key.column: 21, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV19filePrivatePropertySivg", + key.line: 60, + key.column: 21, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.fileprivate + } + ], + key.effective_access: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.decl.function.accessor.setter, + key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV19filePrivatePropertySivs", + key.line: 60, + key.column: 21, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.fileprivate + } + ], + key.effective_access: source.decl.effective_access.fileprivate + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.fileprivate + } + ], + key.effective_access: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", key.line: 60, + key.column: 42 + }, + { + key.kind: source.lang.swift.decl.var.instance, + key.name: "privateProperty", + key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV15privatePropertySivp", + key.line: 61, + key.column: 17, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV15privatePropertySivg", + key.line: 61, + key.column: 17, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.private + } + ], + key.effective_access: source.decl.effective_access.less_than_fileprivate + }, + { + key.kind: source.lang.swift.decl.function.accessor.setter, + key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV15privatePropertySivs", + key.line: 61, + key.column: 17, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.private + } + ], + key.effective_access: source.decl.effective_access.less_than_fileprivate + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.private + } + ], + key.effective_access: source.decl.effective_access.less_than_fileprivate + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 61, + key.column: 34 + }, + { + key.kind: source.lang.swift.decl.var.instance, + key.name: "publicPropertyWithPrivateSetter", + key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV31publicPropertyWithPrivateSetterSivp", + key.line: 62, + key.column: 29, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV31publicPropertyWithPrivateSetterSivg", + key.line: 62, + key.column: 29, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.setter_access.private + }, + { + key.attribute: source.decl.attribute.public + } + ], + key.effective_access: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.decl.function.accessor.setter, + key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV31publicPropertyWithPrivateSetterSivs", + key.line: 62, + key.column: 29, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.setter_access.private + }, + { + key.attribute: source.decl.attribute.public + } + ], + key.effective_access: source.decl.effective_access.fileprivate + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.setter_access.private + }, + { + key.attribute: source.decl.attribute.public + } + ], + key.effective_access: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 62, + key.column: 62 + }, + { + key.kind: source.lang.swift.decl.function.subscript, + key.name: "subscript(_:)", + key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLVyS2icip", + key.line: 64, + key.column: 12, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.name: "getter:subscript(_:)", + key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLVyS2icig", + key.line: 64, + key.column: 51, + key.effective_access: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 64, + key.column: 39 + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 64, + key.column: 47 + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.public + } + ], + key.effective_access: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.decl.function.subscript, + key.name: "subscript(_:)", + key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLVXeip", + key.line: 65, + key.column: 5, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.name: "getter:subscript(_:)", + key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLVXeig", + key.line: 65, + key.column: 46, + key.effective_access: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 65, + key.column: 34 + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 65, + key.column: 42 + } + ], + key.effective_access: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.decl.function.subscript, + key.name: "subscript(_:)", + key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLVXeip", + key.line: 66, + key.column: 17, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.name: "getter:subscript(_:)", + key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLVXeig", + key.line: 66, + key.column: 61, + key.effective_access: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 66, + key.column: 49 + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 66, + key.column: 57 + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.fileprivate + } + ], + key.effective_access: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.decl.function.subscript, + key.name: "subscript(_:)", + key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLVXeip", + key.line: 67, + key.column: 13, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.name: "getter:subscript(_:)", + key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLVXeig", + key.line: 67, + key.column: 53, + key.effective_access: source.decl.effective_access.less_than_fileprivate + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 67, + key.column: 41 + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 67, + key.column: 49 + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.private + } + ], + key.effective_access: source.decl.effective_access.less_than_fileprivate + }, + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "publicMethod()", + key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV12publicMethodyyF", + key.line: 69, key.column: 17, key.attributes: [ { key.attribute: source.decl.attribute.public } ], - key.effective_access_level: source.decl.effective_access.public + key.effective_access: source.decl.effective_access.fileprivate }, { key.kind: source.lang.swift.decl.function.method.instance, - key.name: "b()", - key.usr: "s:28index_effective_access_level17ScopeKeeperStructV1byyF", - key.line: 61, + key.name: "internalMethod()", + key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV14internalMethodyyF", + key.line: 70, key.column: 10, - key.effective_access_level: source.decl.effective_access.internal + key.effective_access: source.decl.effective_access.fileprivate }, { key.kind: source.lang.swift.decl.function.method.instance, - key.name: "c()", - key.usr: "s:28index_effective_access_level17ScopeKeeperStructV1c33_2295DDF1454D6A6D9229E8222CD85214LLyyF", - key.line: 62, + key.name: "filePrivateMethod()", + key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV17filePrivateMethodyyF", + key.line: 71, key.column: 22, key.attributes: [ { key.attribute: source.decl.attribute.fileprivate } ], - key.effective_access_level: source.decl.effective_access.fileprivate + key.effective_access: source.decl.effective_access.fileprivate }, { key.kind: source.lang.swift.decl.function.method.instance, - key.name: "d()", - key.usr: "s:28index_effective_access_level17ScopeKeeperStructV1d33_2295DDF1454D6A6D9229E8222CD85214LLyyF", - key.line: 63, + key.name: "privateMethod()", + key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV13privateMethodyyF", + key.line: 72, key.column: 18, key.attributes: [ { key.attribute: source.decl.attribute.private } ], - key.effective_access_level: source.decl.effective_access.less_than_fileprivate - }, - { - key.kind: source.lang.swift.decl.function.constructor, - key.usr: "s:28index_effective_access_level17ScopeKeeperStructVACycfc", - key.line: 59, - key.column: 15, - key.is_implicit: 1, - key.effective_access_level: source.decl.effective_access.internal + key.effective_access: source.decl.effective_access.less_than_fileprivate } ], key.attributes: [ { - key.attribute: source.decl.attribute.public + key.attribute: source.decl.attribute.private } ], - key.effective_access_level: source.decl.effective_access.public + key.effective_access: source.decl.effective_access.fileprivate }, { key.kind: source.lang.swift.decl.struct, - key.name: "PartialScopeReducerStruct", - key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV", - key.line: 66, - key.column: 8, + key.name: "ScopeKeeperStruct", + key.usr: "s:28index_effective_access_level17ScopeKeeperStructV", + key.line: 75, + key.column: 15, key.entities: [ { - key.kind: source.lang.swift.decl.function.method.instance, - key.name: "a()", - key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV1ayyF", - key.line: 67, - key.column: 17, + key.kind: source.lang.swift.decl.function.constructor, + key.name: "init(publicInitializer:)", + key.usr: "s:28index_effective_access_level17ScopeKeeperStructV17publicInitializerACSi_tcfc", + key.line: 76, + key.column: 12, + key.entities: [ + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 76, + key.column: 36 + } + ], key.attributes: [ { key.attribute: source.decl.attribute.public } ], - key.effective_access_level: source.decl.effective_access.internal + key.effective_access: source.decl.effective_access.public }, { - key.kind: source.lang.swift.decl.function.method.instance, - key.name: "b()", - key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV1byyF", - key.line: 68, - key.column: 10, - key.effective_access_level: source.decl.effective_access.internal + key.kind: source.lang.swift.decl.function.constructor, + key.name: "init(internalInitializer:)", + key.usr: "s:28index_effective_access_level17ScopeKeeperStructV19internalInitializerACSi_tcfc", + key.line: 77, + key.column: 5, + key.entities: [ + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 77, + key.column: 31 + } + ], + key.effective_access: source.decl.effective_access.internal }, { - key.kind: source.lang.swift.decl.function.method.instance, - key.name: "c()", - key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV1c33_2295DDF1454D6A6D9229E8222CD85214LLyyF", - key.line: 69, - key.column: 22, + key.kind: source.lang.swift.decl.function.constructor, + key.name: "init(filePrivateInitializer:)", + key.usr: "s:28index_effective_access_level17ScopeKeeperStructV22filePrivateInitializerACSi_tc33_2295DDF1454D6A6D9229E8222CD85214Llfc", + key.line: 78, + key.column: 17, + key.entities: [ + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 78, + key.column: 46 + } + ], key.attributes: [ { key.attribute: source.decl.attribute.fileprivate } ], - key.effective_access_level: source.decl.effective_access.fileprivate + key.effective_access: source.decl.effective_access.fileprivate }, { - key.kind: source.lang.swift.decl.function.method.instance, - key.name: "d()", - key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV1d33_2295DDF1454D6A6D9229E8222CD85214LLyyF", - key.line: 70, - key.column: 18, + key.kind: source.lang.swift.decl.function.constructor, + key.name: "init(privateInitializer:)", + key.usr: "s:28index_effective_access_level17ScopeKeeperStructV18privateInitializerACSi_tc33_2295DDF1454D6A6D9229E8222CD85214Llfc", + key.line: 79, + key.column: 13, + key.entities: [ + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 79, + key.column: 38 + } + ], key.attributes: [ { key.attribute: source.decl.attribute.private } ], - key.effective_access_level: source.decl.effective_access.less_than_fileprivate + key.effective_access: source.decl.effective_access.less_than_fileprivate }, { - key.kind: source.lang.swift.decl.function.constructor, - key.usr: "s:28index_effective_access_level25PartialScopeReducerStructVACycfc", - key.line: 66, + key.kind: source.lang.swift.decl.var.instance, + key.name: "publicProperty", + key.usr: "s:28index_effective_access_level17ScopeKeeperStructV14publicPropertySivp", + key.line: 81, + key.column: 16, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.usr: "s:28index_effective_access_level17ScopeKeeperStructV14publicPropertySivg", + key.line: 81, + key.column: 16, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.public + } + ], + key.effective_access: source.decl.effective_access.public + }, + { + key.kind: source.lang.swift.decl.function.accessor.setter, + key.usr: "s:28index_effective_access_level17ScopeKeeperStructV14publicPropertySivs", + key.line: 81, + key.column: 16, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.public + } + ], + key.effective_access: source.decl.effective_access.public + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.public + } + ], + key.effective_access: source.decl.effective_access.public + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 81, + key.column: 32 + }, + { + key.kind: source.lang.swift.decl.var.instance, + key.name: "internalProperty", + key.usr: "s:28index_effective_access_level17ScopeKeeperStructV16internalPropertySivp", + key.line: 82, + key.column: 9, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.usr: "s:28index_effective_access_level17ScopeKeeperStructV16internalPropertySivg", + key.line: 82, + key.column: 9, + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.internal + }, + { + key.kind: source.lang.swift.decl.function.accessor.setter, + key.usr: "s:28index_effective_access_level17ScopeKeeperStructV16internalPropertySivs", + key.line: 82, + key.column: 9, + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.internal + } + ], + key.effective_access: source.decl.effective_access.internal + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 82, + key.column: 27 + }, + { + key.kind: source.lang.swift.decl.var.instance, + key.name: "filePrivateProperty", + key.usr: "s:28index_effective_access_level17ScopeKeeperStructV19filePrivateProperty33_2295DDF1454D6A6D9229E8222CD85214LLSivp", + key.line: 83, + key.column: 21, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.usr: "s:28index_effective_access_level17ScopeKeeperStructV19filePrivateProperty33_2295DDF1454D6A6D9229E8222CD85214LLSivg", + key.line: 83, + key.column: 21, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.fileprivate + } + ], + key.effective_access: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.decl.function.accessor.setter, + key.usr: "s:28index_effective_access_level17ScopeKeeperStructV19filePrivateProperty33_2295DDF1454D6A6D9229E8222CD85214LLSivs", + key.line: 83, + key.column: 21, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.fileprivate + } + ], + key.effective_access: source.decl.effective_access.fileprivate + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.fileprivate + } + ], + key.effective_access: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 83, + key.column: 42 + }, + { + key.kind: source.lang.swift.decl.var.instance, + key.name: "privateProperty", + key.usr: "s:28index_effective_access_level17ScopeKeeperStructV15privateProperty33_2295DDF1454D6A6D9229E8222CD85214LLSivp", + key.line: 84, + key.column: 17, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.usr: "s:28index_effective_access_level17ScopeKeeperStructV15privateProperty33_2295DDF1454D6A6D9229E8222CD85214LLSivg", + key.line: 84, + key.column: 17, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.private + } + ], + key.effective_access: source.decl.effective_access.less_than_fileprivate + }, + { + key.kind: source.lang.swift.decl.function.accessor.setter, + key.usr: "s:28index_effective_access_level17ScopeKeeperStructV15privateProperty33_2295DDF1454D6A6D9229E8222CD85214LLSivs", + key.line: 84, + key.column: 17, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.private + } + ], + key.effective_access: source.decl.effective_access.less_than_fileprivate + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.private + } + ], + key.effective_access: source.decl.effective_access.less_than_fileprivate + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 84, + key.column: 34 + }, + { + key.kind: source.lang.swift.decl.var.instance, + key.name: "publicPropertyWithPrivateSetter", + key.usr: "s:28index_effective_access_level17ScopeKeeperStructV31publicPropertyWithPrivateSetterSivp", + key.line: 85, + key.column: 29, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.usr: "s:28index_effective_access_level17ScopeKeeperStructV31publicPropertyWithPrivateSetterSivg", + key.line: 85, + key.column: 29, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.setter_access.private + }, + { + key.attribute: source.decl.attribute.public + } + ], + key.effective_access: source.decl.effective_access.public + }, + { + key.kind: source.lang.swift.decl.function.accessor.setter, + key.usr: "s:28index_effective_access_level17ScopeKeeperStructV31publicPropertyWithPrivateSetterSivs", + key.line: 85, + key.column: 29, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.setter_access.private + }, + { + key.attribute: source.decl.attribute.public + } + ], + key.effective_access: source.decl.effective_access.public + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.setter_access.private + }, + { + key.attribute: source.decl.attribute.public + } + ], + key.effective_access: source.decl.effective_access.public + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 85, + key.column: 62 + }, + { + key.kind: source.lang.swift.decl.function.subscript, + key.name: "subscript(_:)", + key.usr: "s:28index_effective_access_level17ScopeKeeperStructVyS2icip", + key.line: 87, + key.column: 12, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.name: "getter:subscript(_:)", + key.usr: "s:28index_effective_access_level17ScopeKeeperStructVyS2icig", + key.line: 87, + key.column: 51, + key.effective_access: source.decl.effective_access.public + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 87, + key.column: 39 + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 87, + key.column: 47 + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.public + } + ], + key.effective_access: source.decl.effective_access.public + }, + { + key.kind: source.lang.swift.decl.function.subscript, + key.name: "subscript(_:)", + key.usr: "s:28index_effective_access_level17ScopeKeeperStructVXeip", + key.line: 88, + key.column: 5, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.name: "getter:subscript(_:)", + key.usr: "s:28index_effective_access_level17ScopeKeeperStructVXeig", + key.line: 88, + key.column: 46, + key.effective_access: source.decl.effective_access.internal + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 88, + key.column: 34 + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 88, + key.column: 42 + } + ], + key.effective_access: source.decl.effective_access.internal + }, + { + key.kind: source.lang.swift.decl.function.subscript, + key.name: "subscript(_:)", + key.usr: "s:28index_effective_access_level17ScopeKeeperStructVXe33_2295DDF1454D6A6D9229E8222CD85214Llip", + key.line: 89, + key.column: 17, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.name: "getter:subscript(_:)", + key.usr: "s:28index_effective_access_level17ScopeKeeperStructVXe33_2295DDF1454D6A6D9229E8222CD85214Llig", + key.line: 89, + key.column: 61, + key.effective_access: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 89, + key.column: 49 + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 89, + key.column: 57 + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.fileprivate + } + ], + key.effective_access: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.decl.function.subscript, + key.name: "subscript(_:)", + key.usr: "s:28index_effective_access_level17ScopeKeeperStructVXe33_2295DDF1454D6A6D9229E8222CD85214Llip", + key.line: 90, + key.column: 13, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.name: "getter:subscript(_:)", + key.usr: "s:28index_effective_access_level17ScopeKeeperStructVXe33_2295DDF1454D6A6D9229E8222CD85214Llig", + key.line: 90, + key.column: 53, + key.effective_access: source.decl.effective_access.less_than_fileprivate + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 90, + key.column: 41 + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 90, + key.column: 49 + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.private + } + ], + key.effective_access: source.decl.effective_access.less_than_fileprivate + }, + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "publicMethod()", + key.usr: "s:28index_effective_access_level17ScopeKeeperStructV12publicMethodyyF", + key.line: 92, + key.column: 17, + key.attributes: [ + { + key.attribute: source.decl.attribute.public + } + ], + key.effective_access: source.decl.effective_access.public + }, + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "internalMethod()", + key.usr: "s:28index_effective_access_level17ScopeKeeperStructV14internalMethodyyF", + key.line: 93, + key.column: 10, + key.effective_access: source.decl.effective_access.internal + }, + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "filePrivateMethod()", + key.usr: "s:28index_effective_access_level17ScopeKeeperStructV17filePrivateMethod33_2295DDF1454D6A6D9229E8222CD85214LLyyF", + key.line: 94, + key.column: 22, + key.attributes: [ + { + key.attribute: source.decl.attribute.fileprivate + } + ], + key.effective_access: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "privateMethod()", + key.usr: "s:28index_effective_access_level17ScopeKeeperStructV13privateMethod33_2295DDF1454D6A6D9229E8222CD85214LLyyF", + key.line: 95, + key.column: 18, + key.attributes: [ + { + key.attribute: source.decl.attribute.private + } + ], + key.effective_access: source.decl.effective_access.less_than_fileprivate + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.public + } + ], + key.effective_access: source.decl.effective_access.public + }, + { + key.kind: source.lang.swift.decl.struct, + key.name: "PartialScopeReducerStruct", + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV", + key.line: 98, + key.column: 8, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.constructor, + key.name: "init(publicInitializer:)", + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV17publicInitializerACSi_tcfc", + key.line: 99, + key.column: 12, + key.entities: [ + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 99, + key.column: 36 + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.public + } + ], + key.effective_access: source.decl.effective_access.internal + }, + { + key.kind: source.lang.swift.decl.function.constructor, + key.name: "init(internalInitializer:)", + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV19internalInitializerACSi_tcfc", + key.line: 100, + key.column: 5, + key.entities: [ + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 100, + key.column: 31 + } + ], + key.effective_access: source.decl.effective_access.internal + }, + { + key.kind: source.lang.swift.decl.function.constructor, + key.name: "init(filePrivateInitializer:)", + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV22filePrivateInitializerACSi_tc33_2295DDF1454D6A6D9229E8222CD85214Llfc", + key.line: 101, + key.column: 17, + key.entities: [ + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 101, + key.column: 46 + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.fileprivate + } + ], + key.effective_access: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.decl.function.constructor, + key.name: "init(privateInitializer:)", + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV18privateInitializerACSi_tc33_2295DDF1454D6A6D9229E8222CD85214Llfc", + key.line: 102, + key.column: 13, + key.entities: [ + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 102, + key.column: 38 + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.private + } + ], + key.effective_access: source.decl.effective_access.less_than_fileprivate + }, + { + key.kind: source.lang.swift.decl.var.instance, + key.name: "publicProperty", + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV14publicPropertySivp", + key.line: 104, + key.column: 16, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV14publicPropertySivg", + key.line: 104, + key.column: 16, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.public + } + ], + key.effective_access: source.decl.effective_access.internal + }, + { + key.kind: source.lang.swift.decl.function.accessor.setter, + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV14publicPropertySivs", + key.line: 104, + key.column: 16, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.public + } + ], + key.effective_access: source.decl.effective_access.internal + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.public + } + ], + key.effective_access: source.decl.effective_access.internal + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 104, + key.column: 32 + }, + { + key.kind: source.lang.swift.decl.var.instance, + key.name: "internalProperty", + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV16internalPropertySivp", + key.line: 105, + key.column: 9, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV16internalPropertySivg", + key.line: 105, + key.column: 9, + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.internal + }, + { + key.kind: source.lang.swift.decl.function.accessor.setter, + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV16internalPropertySivs", + key.line: 105, + key.column: 9, + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.internal + } + ], + key.effective_access: source.decl.effective_access.internal + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 105, + key.column: 27 + }, + { + key.kind: source.lang.swift.decl.var.instance, + key.name: "filePrivateProperty", + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV19filePrivateProperty33_2295DDF1454D6A6D9229E8222CD85214LLSivp", + key.line: 106, + key.column: 21, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV19filePrivateProperty33_2295DDF1454D6A6D9229E8222CD85214LLSivg", + key.line: 106, + key.column: 21, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.fileprivate + } + ], + key.effective_access: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.decl.function.accessor.setter, + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV19filePrivateProperty33_2295DDF1454D6A6D9229E8222CD85214LLSivs", + key.line: 106, + key.column: 21, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.fileprivate + } + ], + key.effective_access: source.decl.effective_access.fileprivate + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.fileprivate + } + ], + key.effective_access: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 106, + key.column: 42 + }, + { + key.kind: source.lang.swift.decl.var.instance, + key.name: "privateProperty", + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV15privateProperty33_2295DDF1454D6A6D9229E8222CD85214LLSivp", + key.line: 107, + key.column: 17, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV15privateProperty33_2295DDF1454D6A6D9229E8222CD85214LLSivg", + key.line: 107, + key.column: 17, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.private + } + ], + key.effective_access: source.decl.effective_access.less_than_fileprivate + }, + { + key.kind: source.lang.swift.decl.function.accessor.setter, + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV15privateProperty33_2295DDF1454D6A6D9229E8222CD85214LLSivs", + key.line: 107, + key.column: 17, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.private + } + ], + key.effective_access: source.decl.effective_access.less_than_fileprivate + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.private + } + ], + key.effective_access: source.decl.effective_access.less_than_fileprivate + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 107, + key.column: 34 + }, + { + key.kind: source.lang.swift.decl.var.instance, + key.name: "publicPropertyWithPrivateSetter", + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV31publicPropertyWithPrivateSetterSivp", + key.line: 108, + key.column: 29, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV31publicPropertyWithPrivateSetterSivg", + key.line: 108, + key.column: 29, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.setter_access.private + }, + { + key.attribute: source.decl.attribute.public + } + ], + key.effective_access: source.decl.effective_access.internal + }, + { + key.kind: source.lang.swift.decl.function.accessor.setter, + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV31publicPropertyWithPrivateSetterSivs", + key.line: 108, + key.column: 29, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.setter_access.private + }, + { + key.attribute: source.decl.attribute.public + } + ], + key.effective_access: source.decl.effective_access.internal + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.setter_access.private + }, + { + key.attribute: source.decl.attribute.public + } + ], + key.effective_access: source.decl.effective_access.internal + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 108, + key.column: 62 + }, + { + key.kind: source.lang.swift.decl.function.subscript, + key.name: "subscript(_:)", + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructVyS2icip", + key.line: 110, + key.column: 12, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.name: "getter:subscript(_:)", + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructVyS2icig", + key.line: 110, + key.column: 51, + key.effective_access: source.decl.effective_access.internal + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 110, + key.column: 39 + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 110, + key.column: 47 + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.public + } + ], + key.effective_access: source.decl.effective_access.internal + }, + { + key.kind: source.lang.swift.decl.function.subscript, + key.name: "subscript(_:)", + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructVXeip", + key.line: 111, + key.column: 5, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.name: "getter:subscript(_:)", + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructVXeig", + key.line: 111, + key.column: 46, + key.effective_access: source.decl.effective_access.internal + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 111, + key.column: 34 + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 111, + key.column: 42 + } + ], + key.effective_access: source.decl.effective_access.internal + }, + { + key.kind: source.lang.swift.decl.function.subscript, + key.name: "subscript(_:)", + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructVXe33_2295DDF1454D6A6D9229E8222CD85214Llip", + key.line: 112, + key.column: 17, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.name: "getter:subscript(_:)", + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructVXe33_2295DDF1454D6A6D9229E8222CD85214Llig", + key.line: 112, + key.column: 61, + key.effective_access: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 112, + key.column: 49 + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 112, + key.column: 57 + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.fileprivate + } + ], + key.effective_access: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.decl.function.subscript, + key.name: "subscript(_:)", + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructVXe33_2295DDF1454D6A6D9229E8222CD85214Llip", + key.line: 113, + key.column: 13, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.name: "getter:subscript(_:)", + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructVXe33_2295DDF1454D6A6D9229E8222CD85214Llig", + key.line: 113, + key.column: 53, + key.effective_access: source.decl.effective_access.less_than_fileprivate + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 113, + key.column: 41 + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 113, + key.column: 49 + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.private + } + ], + key.effective_access: source.decl.effective_access.less_than_fileprivate + }, + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "publicMethod()", + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV12publicMethodyyF", + key.line: 115, + key.column: 17, + key.attributes: [ + { + key.attribute: source.decl.attribute.public + } + ], + key.effective_access: source.decl.effective_access.internal + }, + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "internalMethod()", + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV14internalMethodyyF", + key.line: 116, + key.column: 10, + key.effective_access: source.decl.effective_access.internal + }, + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "filePrivateMethod()", + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV17filePrivateMethod33_2295DDF1454D6A6D9229E8222CD85214LLyyF", + key.line: 117, + key.column: 22, + key.attributes: [ + { + key.attribute: source.decl.attribute.fileprivate + } + ], + key.effective_access: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "privateMethod()", + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV13privateMethod33_2295DDF1454D6A6D9229E8222CD85214LLyyF", + key.line: 118, + key.column: 18, + key.attributes: [ + { + key.attribute: source.decl.attribute.private + } + ], + key.effective_access: source.decl.effective_access.less_than_fileprivate + } + ], + key.effective_access: source.decl.effective_access.internal + }, + { + key.kind: source.lang.swift.decl.extension.enum, + key.name: "PrivateEnum", + key.usr: "s:e:s:28index_effective_access_level11PrivateEnum33_2295DDF1454D6A6D9229E8222CD85214LLO017privateMethodFromE9ExtensionyyF", + key.line: 121, + key.column: 19, + key.entities: [ + { + key.kind: source.lang.swift.ref.enum, + key.name: "PrivateEnum", + key.usr: "s:28index_effective_access_level11PrivateEnum33_2295DDF1454D6A6D9229E8222CD85214LLO", + key.line: 121, + key.column: 19 + }, + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "privateMethodFromPrivateExtension()", + key.usr: "s:28index_effective_access_level11PrivateEnum33_2295DDF1454D6A6D9229E8222CD85214LLO017privateMethodFromE9ExtensionyyF", + key.line: 122, + key.column: 18, + key.attributes: [ + { + key.attribute: source.decl.attribute.private + } + ], + key.effective_access: source.decl.effective_access.less_than_fileprivate + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.private + } + ] + }, + { + key.kind: source.lang.swift.decl.protocol, + key.name: "PublicProtocol", + key.usr: "s:28index_effective_access_level14PublicProtocolP", + key.line: 125, + key.column: 17, + key.entities: [ + { + key.kind: source.lang.swift.decl.var.instance, + key.name: "member", + key.usr: "s:28index_effective_access_level14PublicProtocolP6memberSivp", + key.line: 126, + key.column: 9, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.name: "getter:member", + key.usr: "s:28index_effective_access_level14PublicProtocolP6memberSivg", + key.line: 126, + key.column: 23, + key.is_dynamic: 1, + key.effective_access: source.decl.effective_access.public + }, + { + key.kind: source.lang.swift.decl.function.accessor.setter, + key.name: "setter:member", + key.usr: "s:28index_effective_access_level14PublicProtocolP6memberSivs", + key.line: 126, + key.column: 27, + key.is_dynamic: 1, + key.effective_access: source.decl.effective_access.public + } + ], + key.effective_access: source.decl.effective_access.public + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 126, + key.column: 17 + }, + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "method()", + key.usr: "s:28index_effective_access_level14PublicProtocolP6methodyyF", + key.line: 127, + key.column: 10, + key.is_dynamic: 1, + key.effective_access: source.decl.effective_access.public + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.public + } + ], + key.effective_access: source.decl.effective_access.public + }, + { + key.kind: source.lang.swift.decl.protocol, + key.name: "InternalProtocol", + key.usr: "s:28index_effective_access_level16InternalProtocolP", + key.line: 130, + key.column: 10, + key.entities: [ + { + key.kind: source.lang.swift.decl.var.instance, + key.name: "member", + key.usr: "s:28index_effective_access_level16InternalProtocolP6memberSivp", + key.line: 131, + key.column: 9, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.name: "getter:member", + key.usr: "s:28index_effective_access_level16InternalProtocolP6memberSivg", + key.line: 131, + key.column: 23, + key.is_dynamic: 1, + key.effective_access: source.decl.effective_access.internal + }, + { + key.kind: source.lang.swift.decl.function.accessor.setter, + key.name: "setter:member", + key.usr: "s:28index_effective_access_level16InternalProtocolP6memberSivs", + key.line: 131, + key.column: 27, + key.is_dynamic: 1, + key.effective_access: source.decl.effective_access.internal + } + ], + key.effective_access: source.decl.effective_access.internal + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 131, + key.column: 17 + }, + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "method()", + key.usr: "s:28index_effective_access_level16InternalProtocolP6methodyyF", + key.line: 132, + key.column: 10, + key.is_dynamic: 1, + key.effective_access: source.decl.effective_access.internal + } + ], + key.effective_access: source.decl.effective_access.internal + }, + { + key.kind: source.lang.swift.decl.protocol, + key.name: "FilePrivateProtocol", + key.usr: "s:28index_effective_access_level19FilePrivateProtocol33_2295DDF1454D6A6D9229E8222CD85214LLP", + key.line: 135, + key.column: 22, + key.entities: [ + { + key.kind: source.lang.swift.decl.var.instance, + key.name: "member", + key.usr: "s:28index_effective_access_level19FilePrivateProtocol33_2295DDF1454D6A6D9229E8222CD85214LLP6memberSivp", + key.line: 136, + key.column: 9, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.name: "getter:member", + key.usr: "s:28index_effective_access_level19FilePrivateProtocol33_2295DDF1454D6A6D9229E8222CD85214LLP6memberSivg", + key.line: 136, + key.column: 23, + key.is_dynamic: 1, + key.effective_access: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.decl.function.accessor.setter, + key.name: "setter:member", + key.usr: "s:28index_effective_access_level19FilePrivateProtocol33_2295DDF1454D6A6D9229E8222CD85214LLP6memberSivs", + key.line: 136, + key.column: 27, + key.is_dynamic: 1, + key.effective_access: source.decl.effective_access.fileprivate + } + ], + key.effective_access: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 136, + key.column: 17 + }, + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "method()", + key.usr: "s:28index_effective_access_level19FilePrivateProtocol33_2295DDF1454D6A6D9229E8222CD85214LLP6methodyyF", + key.line: 137, + key.column: 10, + key.is_dynamic: 1, + key.effective_access: source.decl.effective_access.fileprivate + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.fileprivate + } + ], + key.effective_access: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.decl.protocol, + key.name: "PrivateProtocol", + key.usr: "s:28index_effective_access_level15PrivateProtocol33_2295DDF1454D6A6D9229E8222CD85214LLP", + key.line: 140, + key.column: 18, + key.entities: [ + { + key.kind: source.lang.swift.decl.var.instance, + key.name: "member", + key.usr: "s:28index_effective_access_level15PrivateProtocol33_2295DDF1454D6A6D9229E8222CD85214LLP6memberSivp", + key.line: 141, + key.column: 9, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.name: "getter:member", + key.usr: "s:28index_effective_access_level15PrivateProtocol33_2295DDF1454D6A6D9229E8222CD85214LLP6memberSivg", + key.line: 141, + key.column: 23, + key.is_dynamic: 1, + key.effective_access: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.decl.function.accessor.setter, + key.name: "setter:member", + key.usr: "s:28index_effective_access_level15PrivateProtocol33_2295DDF1454D6A6D9229E8222CD85214LLP6memberSivs", + key.line: 141, + key.column: 27, + key.is_dynamic: 1, + key.effective_access: source.decl.effective_access.fileprivate + } + ], + key.effective_access: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 141, + key.column: 17 + }, + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "method()", + key.usr: "s:28index_effective_access_level15PrivateProtocol33_2295DDF1454D6A6D9229E8222CD85214LLP6methodyyF", + key.line: 142, + key.column: 10, + key.is_dynamic: 1, + key.effective_access: source.decl.effective_access.fileprivate + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.private + } + ], + key.effective_access: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.decl.struct, + key.name: "FilePrivateImplementationOfPublicProtocol", + key.usr: "s:28index_effective_access_level41FilePrivateImplementationOfPublicProtocol33_2295DDF1454D6A6D9229E8222CD85214LLV", + key.line: 145, + key.column: 20, + key.related: [ + { + key.kind: source.lang.swift.ref.protocol, + key.name: "PublicProtocol", + key.usr: "s:28index_effective_access_level14PublicProtocolP", + key.line: 145, + key.column: 63 + } + ], + key.entities: [ + { + key.kind: source.lang.swift.ref.protocol, + key.name: "PublicProtocol", + key.usr: "s:28index_effective_access_level14PublicProtocolP", + key.line: 145, + key.column: 63 + }, + { + key.kind: source.lang.swift.decl.var.instance, + key.name: "member", + key.usr: "s:28index_effective_access_level41FilePrivateImplementationOfPublicProtocol33_2295DDF1454D6A6D9229E8222CD85214LLV6memberSivp", + key.line: 146, + key.column: 21, + key.related: [ + { + key.kind: source.lang.swift.ref.var.instance, + key.name: "member", + key.usr: "s:28index_effective_access_level14PublicProtocolP6memberSivp" + } + ], + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.usr: "s:28index_effective_access_level41FilePrivateImplementationOfPublicProtocol33_2295DDF1454D6A6D9229E8222CD85214LLV6memberSivg", + key.line: 146, + key.column: 21, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.fileprivate + } + ], + key.effective_access: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.decl.function.accessor.setter, + key.usr: "s:28index_effective_access_level41FilePrivateImplementationOfPublicProtocol33_2295DDF1454D6A6D9229E8222CD85214LLV6memberSivs", + key.line: 146, + key.column: 21, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.fileprivate + } + ], + key.effective_access: source.decl.effective_access.fileprivate + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.fileprivate + } + ], + key.effective_access: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 146, + key.column: 29 + }, + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "method()", + key.usr: "s:28index_effective_access_level41FilePrivateImplementationOfPublicProtocol33_2295DDF1454D6A6D9229E8222CD85214LLV6methodyyF", + key.line: 147, + key.column: 22, + key.related: [ + { + key.kind: source.lang.swift.ref.function.method.instance, + key.name: "method()", + key.usr: "s:28index_effective_access_level14PublicProtocolP6methodyyF" + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.fileprivate + } + ], + key.effective_access: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.decl.function.constructor, + key.usr: "s:28index_effective_access_level41FilePrivateImplementationOfPublicProtocol33_2295DDF1454D6A6D9229E8222CD85214LLV6memberADSi_tcfc", + key.line: 145, + key.column: 20, + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.decl.function.constructor, + key.usr: "s:28index_effective_access_level41FilePrivateImplementationOfPublicProtocol33_2295DDF1454D6A6D9229E8222CD85214LLVADycfc", + key.line: 145, + key.column: 20, + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.fileprivate + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.fileprivate + } + ], + key.effective_access: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.decl.class, + key.name: "OpenClass", + key.usr: "s:28index_effective_access_level9OpenClassC", + key.line: 150, + key.column: 12, + key.entities: [ + { + key.kind: source.lang.swift.decl.var.instance, + key.name: "openProperty", + key.usr: "s:28index_effective_access_level9OpenClassC12openPropertySivp", + key.line: 151, + key.column: 14, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.name: "getter:openProperty", + key.usr: "s:28index_effective_access_level9OpenClassC12openPropertySivg", + key.line: 151, + key.column: 32, + key.is_dynamic: 1, + key.effective_access: source.decl.effective_access.public + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.open + } + ], + key.effective_access: source.decl.effective_access.public + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 151, + key.column: 28 + }, + { + key.kind: source.lang.swift.decl.var.instance, + key.name: "publicProperty", + key.usr: "s:28index_effective_access_level9OpenClassC14publicPropertySivp", + key.line: 152, + key.column: 16, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.name: "getter:publicProperty", + key.usr: "s:28index_effective_access_level9OpenClassC14publicPropertySivg", + key.line: 152, + key.column: 36, + key.is_dynamic: 1, + key.effective_access: source.decl.effective_access.public + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.public + } + ], + key.effective_access: source.decl.effective_access.public + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 152, + key.column: 32 + }, + { + key.kind: source.lang.swift.decl.var.instance, + key.name: "internalProperty", + key.usr: "s:28index_effective_access_level9OpenClassC16internalPropertySivp", + key.line: 153, + key.column: 9, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.name: "getter:internalProperty", + key.usr: "s:28index_effective_access_level9OpenClassC16internalPropertySivg", + key.line: 153, + key.column: 31, + key.is_dynamic: 1, + key.effective_access: source.decl.effective_access.internal + } + ], + key.effective_access: source.decl.effective_access.internal + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 153, + key.column: 27 + }, + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "openMethod()", + key.usr: "s:28index_effective_access_level9OpenClassC10openMethodyyF", + key.line: 155, + key.column: 15, + key.is_dynamic: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.open + } + ], + key.effective_access: source.decl.effective_access.public + }, + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "publicMethod()", + key.usr: "s:28index_effective_access_level9OpenClassC12publicMethodyyF", + key.line: 156, + key.column: 17, + key.is_dynamic: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.public + } + ], + key.effective_access: source.decl.effective_access.public + }, + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "internalMethod()", + key.usr: "s:28index_effective_access_level9OpenClassC14internalMethodyyF", + key.line: 157, + key.column: 10, + key.is_dynamic: 1, + key.effective_access: source.decl.effective_access.internal + }, + { + key.kind: source.lang.swift.decl.function.constructor, + key.usr: "s:28index_effective_access_level9OpenClassCACycfc", + key.line: 150, + key.column: 12, + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.internal + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.open + } + ], + key.effective_access: source.decl.effective_access.public + }, + { + key.kind: source.lang.swift.ref.module, + key.name: "Module", + key.usr: "c:@M@Module", + key.line: 160, + key.column: 8 + }, + { + key.kind: source.lang.swift.decl.struct, + key.name: "InternalStruct", + key.usr: "s:28index_effective_access_level14InternalStructV", + key.line: 162, + key.column: 8, + key.entities: [ + { + key.kind: source.lang.swift.decl.var.instance, + key.name: "propertyReferencingPublicClassFromModule", + key.usr: "s:28index_effective_access_level14InternalStructV40propertyReferencingPublicClassFromModule0L00lJ0Cvp", + key.line: 163, + key.column: 9, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.usr: "s:28index_effective_access_level14InternalStructV40propertyReferencingPublicClassFromModule0L00lJ0Cvg", + key.line: 163, + key.column: 9, + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.internal + }, + { + key.kind: source.lang.swift.decl.function.accessor.setter, + key.usr: "s:28index_effective_access_level14InternalStructV40propertyReferencingPublicClassFromModule0L00lJ0Cvs", + key.line: 163, + key.column: 9, + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.internal + } + ], + key.effective_access: source.decl.effective_access.internal + }, + { + key.kind: source.lang.swift.ref.module, + key.name: "Module", + key.usr: "c:@M@Module", + key.line: 163, + key.column: 51 + }, + { + key.kind: source.lang.swift.ref.class, + key.name: "ModuleClass", + key.usr: "s:6Module0A5ClassC", + key.line: 163, + key.column: 58 + }, + { + key.kind: source.lang.swift.decl.var.instance, + key.name: "propertyReferencingPublicClassFromExportedModule", + key.usr: "s:28index_effective_access_level14InternalStructV48propertyReferencingPublicClassFromExportedModule0L00lJ0Cvp", + key.line: 164, + key.column: 9, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.usr: "s:28index_effective_access_level14InternalStructV48propertyReferencingPublicClassFromExportedModule0L00lJ0Cvg", + key.line: 164, + key.column: 9, + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.internal + }, + { + key.kind: source.lang.swift.decl.function.accessor.setter, + key.usr: "s:28index_effective_access_level14InternalStructV48propertyReferencingPublicClassFromExportedModule0L00lJ0Cvs", + key.line: 164, + key.column: 9, + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.internal + } + ], + key.effective_access: source.decl.effective_access.internal + }, + { + key.kind: source.lang.swift.ref.module, + key.name: "Exported", + key.usr: "c:@M@Exported", + key.line: 164, + key.column: 59 + }, + { + key.kind: source.lang.swift.ref.class, + key.name: "ExportedClass", + key.usr: "s:8Exported0A5ClassC", + key.line: 164, + key.column: 68 + }, + { + key.kind: source.lang.swift.decl.function.constructor, + key.usr: "s:28index_effective_access_level14InternalStructV40propertyReferencingPublicClassFromModule0ghijk8ExportedL0AC0L00lJ0C_0M00mJ0Ctcfc", + key.line: 162, key.column: 8, key.is_implicit: 1, - key.effective_access_level: source.decl.effective_access.internal + key.effective_access: source.decl.effective_access.internal } ], - key.effective_access_level: source.decl.effective_access.internal + key.effective_access: source.decl.effective_access.internal } ] } diff --git a/test/SourceKit/Indexing/index_enum_case.swift.response b/test/SourceKit/Indexing/index_enum_case.swift.response index 7e85204ca105b..0586e13577df4 100644 --- a/test/SourceKit/Indexing/index_enum_case.swift.response +++ b/test/SourceKit/Indexing/index_enum_case.swift.response @@ -20,7 +20,8 @@ key.name: "one", key.usr: "s:15index_enum_case1EO3oneyA2CmF", key.line: 6, - key.column: 10 + key.column: 10, + key.effective_access: source.decl.effective_access.public }, { key.kind: source.lang.swift.decl.enumelement, @@ -36,14 +37,16 @@ key.line: 6, key.column: 22 } - ] + ], + key.effective_access: source.decl.effective_access.public }, { key.kind: source.lang.swift.decl.enumelement, key.name: "three", key.usr: "s:15index_enum_case1EO5threeyA2CmF", key.line: 6, - key.column: 31 + key.column: 31, + key.effective_access: source.decl.effective_access.public }, { key.kind: source.lang.swift.decl.var.instance, @@ -80,9 +83,11 @@ key.line: 14, key.column: 15 } - ] + ], + key.effective_access: source.decl.effective_access.internal } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.ref.struct, @@ -96,7 +101,8 @@ { key.attribute: source.decl.attribute.public } - ] + ], + key.effective_access: source.decl.effective_access.public }, { key.kind: source.lang.swift.decl.var.global, @@ -110,16 +116,19 @@ key.usr: "s:15index_enum_case1eAA1EOvg", key.line: 21, key.column: 5, - key.is_implicit: 1 + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.accessor.setter, key.usr: "s:15index_enum_case1eAA1EOvs", key.line: 21, key.column: 5, - key.is_implicit: 1 + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.internal } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.ref.enum, @@ -156,7 +165,8 @@ key.line: 28, key.column: 12 } - ] + ], + key.effective_access: source.decl.effective_access.internal } ] } diff --git a/test/SourceKit/Indexing/index_forbid_typecheck.swift.response b/test/SourceKit/Indexing/index_forbid_typecheck.swift.response index 3417ee82d5690..b2670172e6ac6 100644 --- a/test/SourceKit/Indexing/index_forbid_typecheck.swift.response +++ b/test/SourceKit/Indexing/index_forbid_typecheck.swift.response @@ -20,16 +20,19 @@ key.usr: "s:16forbid_typecheck10globalPrimSivg", key.line: 1, key.column: 5, - key.is_implicit: 1 + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.accessor.setter, key.usr: "s:16forbid_typecheck10globalPrimSivs", key.line: 1, key.column: 5, - key.is_implicit: 1 + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.internal } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.ref.var.global, @@ -93,7 +96,8 @@ } ] } - ] + ], + key.effective_access: source.decl.effective_access.internal } ] } diff --git a/test/SourceKit/Indexing/index_func_import.swift.response b/test/SourceKit/Indexing/index_func_import.swift.response index abfae5f82e293..d2746122538ab 100644 --- a/test/SourceKit/Indexing/index_func_import.swift.response +++ b/test/SourceKit/Indexing/index_func_import.swift.response @@ -63,7 +63,8 @@ key.line: 10, key.column: 3 } - ] + ], + key.effective_access: source.decl.effective_access.internal } ] } diff --git a/test/SourceKit/Indexing/index_is_test_candidate_objc.swift.response b/test/SourceKit/Indexing/index_is_test_candidate_objc.swift.response index 787cc50b45388..c6a988f0ff967 100644 --- a/test/SourceKit/Indexing/index_is_test_candidate_objc.swift.response +++ b/test/SourceKit/Indexing/index_is_test_candidate_objc.swift.response @@ -13,7 +13,8 @@ key.name: "test_takesNoParams_andReturnsVoid_butIsNotAnInstanceMethod()", key.usr: "s:28index_is_test_candidate_objc0C54_takesNoParams_andReturnsVoid_butIsNotAnInstanceMethodyyF", key.line: 9, - key.column: 6 + key.column: 6, + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.struct, @@ -27,16 +28,19 @@ key.name: "test_startsWithTest_takesNoParams_returnsVoid_butIsDefinedOnAStruct()", key.usr: "s:28index_is_test_candidate_objc8MyStructV0C63_startsWithTest_takesNoParams_returnsVoid_butIsDefinedOnAStructyyF", key.line: 12, - key.column: 8 + key.column: 8, + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.constructor, key.usr: "s:28index_is_test_candidate_objc8MyStructVACycfc", key.line: 11, key.column: 8, - key.is_implicit: 1 + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.internal } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.class, @@ -50,9 +54,11 @@ key.usr: "s:28index_is_test_candidate_objc10XCTestCaseCACycfc", key.line: 14, key.column: 7, - key.is_implicit: 1 + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.internal } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.class, @@ -84,7 +90,8 @@ key.line: 16, key.column: 8, key.is_dynamic: 1, - key.is_test_candidate: 1 + key.is_test_candidate: 1, + key.effective_access: source.decl.effective_access.fileprivate }, { key.kind: source.lang.swift.decl.function.constructor, @@ -103,7 +110,8 @@ { key.attribute: source.decl.attribute.override } - ] + ], + key.effective_access: source.decl.effective_access.fileprivate } ], key.attributes: [ @@ -111,7 +119,8 @@ key.attribute: source.decl.attribute.private } ], - key.is_test_candidate: 1 + key.is_test_candidate: 1, + key.effective_access: source.decl.effective_access.fileprivate }, { key.kind: source.lang.swift.decl.class, @@ -142,7 +151,8 @@ key.usr: "s:28index_is_test_candidate_objc7MyClassC20doesNotStartWithTestyyF", key.line: 20, key.column: 8, - key.is_dynamic: 1 + key.is_dynamic: 1, + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.method.instance, @@ -159,7 +169,8 @@ key.line: 21, key.column: 50 } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.method.instance, @@ -176,7 +187,8 @@ key.line: 22, key.column: 68 } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.method.instance, @@ -190,7 +202,8 @@ key.attribute: source.decl.attribute.private } ], - key.is_test_candidate: 1 + key.is_test_candidate: 1, + key.effective_access: source.decl.effective_access.less_than_fileprivate }, { key.kind: source.lang.swift.decl.function.method.instance, @@ -199,7 +212,8 @@ key.line: 24, key.column: 8, key.is_dynamic: 1, - key.is_test_candidate: 1 + key.is_test_candidate: 1, + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.method.instance, @@ -208,7 +222,8 @@ key.line: 25, key.column: 8, key.is_dynamic: 1, - key.is_test_candidate: 1 + key.is_test_candidate: 1, + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.constructor, @@ -227,7 +242,8 @@ { key.attribute: source.decl.attribute.override } - ] + ], + key.effective_access: source.decl.effective_access.internal } ], key.attributes: [ @@ -235,7 +251,8 @@ key.attribute: source.decl.attribute.public } ], - key.is_test_candidate: 1 + key.is_test_candidate: 1, + key.effective_access: source.decl.effective_access.public } ] } diff --git a/test/SourceKit/Indexing/index_objcMembers.swift.response b/test/SourceKit/Indexing/index_objcMembers.swift.response index a75108f1f1995..100c6adc5a1e9 100644 --- a/test/SourceKit/Indexing/index_objcMembers.swift.response +++ b/test/SourceKit/Indexing/index_objcMembers.swift.response @@ -28,7 +28,8 @@ key.line: 6, key.column: 9, key.is_dynamic: 1, - key.is_implicit: 1 + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.accessor.setter, @@ -36,9 +37,11 @@ key.line: 6, key.column: 9, key.is_dynamic: 1, - key.is_implicit: 1 + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.internal } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.ref.struct, @@ -58,7 +61,8 @@ { key.attribute: source.decl.attribute.objc } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.constructor, @@ -70,14 +74,16 @@ { key.attribute: source.decl.attribute.objc } - ] + ], + key.effective_access: source.decl.effective_access.internal } ], key.attributes: [ { key.attribute: source.decl.attribute.objcMembers } - ] + ], + key.effective_access: source.decl.effective_access.internal } ] } diff --git a/test/SourceKit/Indexing/index_operators.swift.response b/test/SourceKit/Indexing/index_operators.swift.response index 20027550b270d..0f528bb5faec0 100644 --- a/test/SourceKit/Indexing/index_operators.swift.response +++ b/test/SourceKit/Indexing/index_operators.swift.response @@ -20,9 +20,11 @@ key.name: "init()", key.usr: "s:15index_operators6ClassACACycfc", key.line: 5, - key.column: 5 + key.column: 5, + key.effective_access: source.decl.effective_access.internal } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.operator.infix, @@ -52,7 +54,8 @@ key.line: 8, key.column: 37 } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.struct, @@ -111,7 +114,8 @@ key.column: 19, key.receiver_usr: "s:15index_operators7StructBV" } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.operator.infix, @@ -146,16 +150,19 @@ { key.attribute: source.decl.attribute.public } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.constructor, key.usr: "s:15index_operators7StructBVACycfc", key.line: 12, key.column: 8, - key.is_implicit: 1 + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.internal } - ] + ], + key.effective_access: source.decl.effective_access.internal } ] } diff --git a/test/SourceKit/Indexing/rdar_21602898.swift.response b/test/SourceKit/Indexing/rdar_21602898.swift.response index 92cab6155bada..85493ddd51e88 100644 --- a/test/SourceKit/Indexing/rdar_21602898.swift.response +++ b/test/SourceKit/Indexing/rdar_21602898.swift.response @@ -13,7 +13,8 @@ key.name: "P", key.usr: "s:13rdar_216028981PP", key.line: 4, - key.column: 10 + key.column: 10, + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.class, @@ -64,9 +65,11 @@ key.usr: "s:13rdar_216028981CCACycfc", key.line: 5, key.column: 7, - key.is_implicit: 1 + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.internal } - ] + ], + key.effective_access: source.decl.effective_access.internal } ] } diff --git a/test/SourceKit/Indexing/sr_3815.swift.response b/test/SourceKit/Indexing/sr_3815.swift.response index 5100a76945673..77ac159b14d65 100644 --- a/test/SourceKit/Indexing/sr_3815.swift.response +++ b/test/SourceKit/Indexing/sr_3815.swift.response @@ -29,7 +29,8 @@ key.line: 5, key.column: 21 } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.method.instance, @@ -37,9 +38,11 @@ key.usr: "s:7sr_38151PP1fyyF", key.line: 6, key.column: 8, - key.is_dynamic: 1 + key.is_dynamic: 1, + key.effective_access: source.decl.effective_access.internal } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.struct, @@ -78,7 +81,8 @@ key.line: 10, key.column: 21 } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.method.instance, @@ -92,16 +96,19 @@ key.name: "f()", key.usr: "s:7sr_38151PP1fyyF" } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.constructor, key.usr: "s:7sr_38151SVACycfc", key.line: 9, key.column: 8, - key.is_implicit: 1 + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.internal } - ] + ], + key.effective_access: source.decl.effective_access.internal } ] } diff --git a/tools/SourceKit/include/SourceKit/Core/LangSupport.h b/tools/SourceKit/include/SourceKit/Core/LangSupport.h index a6b3ce6d47ab6..7bfbd371d9e49 100644 --- a/tools/SourceKit/include/SourceKit/Core/LangSupport.h +++ b/tools/SourceKit/include/SourceKit/Core/LangSupport.h @@ -51,7 +51,7 @@ struct EntityInfo { unsigned Line = 0; unsigned Column = 0; ArrayRef Attrs; - Optional EffectiveAccessLevel; + Optional EffectiveAccess; EntityInfo() = default; }; diff --git a/tools/SourceKit/lib/SwiftLang/SwiftIndexing.cpp b/tools/SourceKit/lib/SwiftLang/SwiftIndexing.cpp index d70f59af7127c..9f3c4c54127d6 100644 --- a/tools/SourceKit/lib/SwiftLang/SwiftIndexing.cpp +++ b/tools/SourceKit/lib/SwiftLang/SwiftIndexing.cpp @@ -138,7 +138,7 @@ class SKIndexDataConsumer : public IndexDataConsumer { if (symbol.symInfo.Kind != SymbolKind::Extension) { AccessScope accessScope = VD->getFormalAccessScope(); UIdent AttrUID = SwiftLangSupport::getUIDForFormalAccessScope(accessScope); - info.EffectiveAccessLevel = AttrUID; + info.EffectiveAccess = AttrUID; } } } diff --git a/tools/SourceKit/lib/SwiftLang/SwiftLangSupport.cpp b/tools/SourceKit/lib/SwiftLang/SwiftLangSupport.cpp index 4828be706cafe..f2becfabbef1c 100644 --- a/tools/SourceKit/lib/SwiftLang/SwiftLangSupport.cpp +++ b/tools/SourceKit/lib/SwiftLang/SwiftLangSupport.cpp @@ -819,8 +819,10 @@ UIdent SwiftLangSupport::getUIDForFormalAccessScope(const swift::AccessScope Sco return EffectiveAccess_Internal; } else if (Scope.isFileScope()) { return EffectiveAccess_FilePrivate; - } else { + } else if (Scope.isPrivate()) { return EffectiveAccess_LessThanFilePrivate; + } else { + llvm_unreachable("Unsupported access scope"); } } diff --git a/tools/SourceKit/tools/sourcekitd/lib/API/Requests.cpp b/tools/SourceKit/tools/sourcekitd/lib/API/Requests.cpp index 40775236eddc3..e388918ef6a49 100644 --- a/tools/SourceKit/tools/sourcekitd/lib/API/Requests.cpp +++ b/tools/SourceKit/tools/sourcekitd/lib/API/Requests.cpp @@ -1355,8 +1355,8 @@ bool SKIndexingConsumer::startSourceEntity(const EntityInfo &Info) { } } - if (Info.EffectiveAccessLevel) - Elem.set(KeyEffectiveAccessLevel, Info.EffectiveAccessLevel.getValue()); + if (Info.EffectiveAccess) + Elem.set(KeyEffectiveAccess, Info.EffectiveAccess.getValue()); EntitiesStack.push_back({ Info.Kind, Elem, ResponseBuilder::Array(), ResponseBuilder::Array()}); diff --git a/utils/gyb_sourcekit_support/UIDs.py b/utils/gyb_sourcekit_support/UIDs.py index d00da912af5f2..eeed7c7f27ba0 100644 --- a/utils/gyb_sourcekit_support/UIDs.py +++ b/utils/gyb_sourcekit_support/UIDs.py @@ -183,7 +183,7 @@ def __init__(self, internal_name, external_name): 'key.completion_check_dependency_interval'), KEY('AnnotatedTypename', 'key.annotated.typename'), KEY('CompileOperation', 'key.compile_operation'), - KEY('EffectiveAccessLevel', 'key.effective_access_level'), + KEY('EffectiveAccess', 'key.effective_access'), ] From 9b05823c88257b6fc72b600cacc31513c9f74072 Mon Sep 17 00:00:00 2001 From: Bruno Rocha Date: Tue, 26 May 2020 18:16:12 +0200 Subject: [PATCH 03/50] Remove accessors and add PW tests --- .../Inputs/implicit-vis/a.index.response | 6 +- .../Inputs/implicit-vis/b.index.response | 6 +- .../Inputs/test_module.index.response | 18 +- test/SourceKit/Indexing/index.swift.response | 69 +- .../index_bad_modulename.swift.response | 6 +- .../Indexing/index_big_array.swift.response | 6 +- .../index_constructors.swift.response | 6 +- .../index_effective_access_level.swift | 38 + ...ndex_effective_access_level.swift.response | 1921 +++++++++++++---- .../Indexing/index_enum_case.swift.response | 9 +- .../index_forbid_typecheck.swift.response | 6 +- .../Indexing/index_objcMembers.swift.response | 6 +- .../SourceKit/lib/SwiftLang/SwiftIndexing.cpp | 25 +- 13 files changed, 1606 insertions(+), 516 deletions(-) diff --git a/test/SourceKit/Indexing/Inputs/implicit-vis/a.index.response b/test/SourceKit/Indexing/Inputs/implicit-vis/a.index.response index 0c8fa8f5fbaee..5293536da6ab4 100644 --- a/test/SourceKit/Indexing/Inputs/implicit-vis/a.index.response +++ b/test/SourceKit/Indexing/Inputs/implicit-vis/a.index.response @@ -28,8 +28,7 @@ key.line: 2, key.column: 6, key.is_dynamic: 1, - key.is_implicit: 1, - key.effective_access: source.decl.effective_access.internal + key.is_implicit: 1 }, { key.kind: source.lang.swift.decl.function.accessor.setter, @@ -37,8 +36,7 @@ key.line: 2, key.column: 6, key.is_dynamic: 1, - key.is_implicit: 1, - key.effective_access: source.decl.effective_access.internal + key.is_implicit: 1 } ], key.effective_access: source.decl.effective_access.internal diff --git a/test/SourceKit/Indexing/Inputs/implicit-vis/b.index.response b/test/SourceKit/Indexing/Inputs/implicit-vis/b.index.response index 23af51f23070a..bdee38bf38ada 100644 --- a/test/SourceKit/Indexing/Inputs/implicit-vis/b.index.response +++ b/test/SourceKit/Indexing/Inputs/implicit-vis/b.index.response @@ -28,8 +28,7 @@ key.line: 2, key.column: 6, key.is_dynamic: 1, - key.is_implicit: 1, - key.effective_access: source.decl.effective_access.internal + key.is_implicit: 1 }, { key.kind: source.lang.swift.decl.function.accessor.setter, @@ -37,8 +36,7 @@ key.line: 2, key.column: 6, key.is_dynamic: 1, - key.is_implicit: 1, - key.effective_access: source.decl.effective_access.internal + key.is_implicit: 1 } ], key.effective_access: source.decl.effective_access.internal diff --git a/test/SourceKit/Indexing/Inputs/test_module.index.response b/test/SourceKit/Indexing/Inputs/test_module.index.response index 3082457c3f464..85b907997c761 100644 --- a/test/SourceKit/Indexing/Inputs/test_module.index.response +++ b/test/SourceKit/Indexing/Inputs/test_module.index.response @@ -42,15 +42,13 @@ key.kind: source.lang.swift.decl.function.accessor.getter, key.usr: "s:11test_module7TwoIntsC1xSivg", key.is_dynamic: 1, - key.is_implicit: 1, - key.effective_access: source.decl.effective_access.public + key.is_implicit: 1 }, { key.kind: source.lang.swift.decl.function.accessor.setter, key.usr: "s:11test_module7TwoIntsC1xSivs", key.is_dynamic: 1, - key.is_implicit: 1, - key.effective_access: source.decl.effective_access.public + key.is_implicit: 1 } ], key.effective_access: source.decl.effective_access.public @@ -64,15 +62,13 @@ key.kind: source.lang.swift.decl.function.accessor.getter, key.usr: "s:11test_module7TwoIntsC1ySivg", key.is_dynamic: 1, - key.is_implicit: 1, - key.effective_access: source.decl.effective_access.public + key.is_implicit: 1 }, { key.kind: source.lang.swift.decl.function.accessor.setter, key.usr: "s:11test_module7TwoIntsC1ySivs", key.is_dynamic: 1, - key.is_implicit: 1, - key.effective_access: source.decl.effective_access.public + key.is_implicit: 1 } ], key.effective_access: source.decl.effective_access.public @@ -100,15 +96,13 @@ key.kind: source.lang.swift.decl.function.accessor.getter, key.name: "getter:value", key.usr: "s:11test_module16ComputedPropertyC5valueSivg", - key.is_dynamic: 1, - key.effective_access: source.decl.effective_access.public + key.is_dynamic: 1 }, { key.kind: source.lang.swift.decl.function.accessor.setter, key.name: "setter:value", key.usr: "s:11test_module16ComputedPropertyC5valueSivs", - key.is_dynamic: 1, - key.effective_access: source.decl.effective_access.public + key.is_dynamic: 1 } ], key.effective_access: source.decl.effective_access.public diff --git a/test/SourceKit/Indexing/index.swift.response b/test/SourceKit/Indexing/index.swift.response index c896f17a8918b..dd07c5020b0af 100644 --- a/test/SourceKit/Indexing/index.swift.response +++ b/test/SourceKit/Indexing/index.swift.response @@ -20,16 +20,14 @@ key.usr: , key.line: 4, key.column: 5, - key.is_implicit: 1, - key.effective_access: source.decl.effective_access.internal + key.is_implicit: 1 }, { key.kind: source.lang.swift.decl.function.accessor.setter, key.usr: , key.line: 4, key.column: 5, - key.is_implicit: 1, - key.effective_access: source.decl.effective_access.internal + key.is_implicit: 1 } ], key.effective_access: source.decl.effective_access.internal @@ -69,8 +67,7 @@ key.line: 8, key.column: 7, key.is_dynamic: 1, - key.is_implicit: 1, - key.effective_access: source.decl.effective_access.internal + key.is_implicit: 1 }, { key.kind: source.lang.swift.decl.function.accessor.setter, @@ -78,8 +75,7 @@ key.line: 8, key.column: 7, key.is_dynamic: 1, - key.is_implicit: 1, - key.effective_access: source.decl.effective_access.internal + key.is_implicit: 1 } ], key.effective_access: source.decl.effective_access.internal @@ -500,8 +496,7 @@ key.usr: , key.line: 52, key.column: 18, - key.is_dynamic: 1, - key.effective_access: source.decl.effective_access.internal + key.is_dynamic: 1 } ], key.effective_access: source.decl.effective_access.internal @@ -588,16 +583,14 @@ key.usr: , key.line: 57, key.column: 5, - key.is_implicit: 1, - key.effective_access: source.decl.effective_access.internal + key.is_implicit: 1 }, { key.kind: source.lang.swift.decl.function.accessor.setter, key.usr: , key.line: 57, key.column: 5, - key.is_implicit: 1, - key.effective_access: source.decl.effective_access.internal + key.is_implicit: 1 } ], key.effective_access: source.decl.effective_access.internal @@ -629,8 +622,7 @@ key.usr: , key.line: 61, key.column: 5, - key.is_dynamic: 1, - key.effective_access: source.decl.effective_access.internal + key.is_dynamic: 1 }, { key.kind: source.lang.swift.decl.function.accessor.setter, @@ -638,8 +630,7 @@ key.usr: , key.line: 65, key.column: 5, - key.is_dynamic: 1, - key.effective_access: source.decl.effective_access.internal + key.is_dynamic: 1 } ], key.effective_access: source.decl.effective_access.internal @@ -664,8 +655,7 @@ key.usr: , key.line: 70, key.column: 22, - key.is_dynamic: 1, - key.effective_access: source.decl.effective_access.internal + key.is_dynamic: 1 } ], key.effective_access: source.decl.effective_access.internal @@ -839,8 +829,7 @@ key.usr: , key.line: 82, key.column: 5, - key.is_dynamic: 1, - key.effective_access: source.decl.effective_access.internal + key.is_dynamic: 1 }, { key.kind: source.lang.swift.decl.function.accessor.setter, @@ -858,8 +847,7 @@ key.column: 8, key.receiver_usr: "s:Si" } - ], - key.effective_access: source.decl.effective_access.internal + ] }, { key.kind: source.lang.swift.ref.struct, @@ -1057,8 +1045,7 @@ key.line: 107, key.column: 12 } - ], - key.effective_access: source.decl.effective_access.internal + ] } ], key.effective_access: source.decl.effective_access.internal @@ -1437,8 +1424,7 @@ key.line: 151, key.column: 7, key.is_dynamic: 1, - key.is_implicit: 1, - key.effective_access: source.decl.effective_access.internal + key.is_implicit: 1 }, { key.kind: source.lang.swift.decl.function.accessor.setter, @@ -1446,8 +1432,7 @@ key.line: 151, key.column: 7, key.is_dynamic: 1, - key.is_implicit: 1, - key.effective_access: source.decl.effective_access.internal + key.is_implicit: 1 }, { key.kind: source.lang.swift.decl.function.accessor.willset, @@ -1463,8 +1448,7 @@ key.line: 153, key.column: 7 } - ], - key.effective_access: source.decl.effective_access.less_than_fileprivate + ] }, { key.kind: source.lang.swift.decl.function.accessor.didset, @@ -1480,8 +1464,7 @@ key.line: 156, key.column: 7 } - ], - key.effective_access: source.decl.effective_access.less_than_fileprivate + ] } ], key.effective_access: source.decl.effective_access.internal @@ -1516,8 +1499,7 @@ key.usr: , key.line: 165, key.column: 5, - key.is_dynamic: 1, - key.effective_access: source.decl.effective_access.internal + key.is_dynamic: 1 }, { key.kind: source.lang.swift.decl.function.accessor.setter, @@ -1525,16 +1507,14 @@ key.usr: , key.line: 168, key.column: 5, - key.is_dynamic: 1, - key.effective_access: source.decl.effective_access.internal + key.is_dynamic: 1 }, { key.kind: source.lang.swift.decl.function.accessor.didset, key.name: "didSet:S1", key.usr: , key.line: 170, - key.column: 5, - key.effective_access: source.decl.effective_access.less_than_fileprivate + key.column: 5 } ], key.effective_access: source.decl.effective_access.internal @@ -1577,8 +1557,7 @@ key.usr: , key.line: 177, key.column: 5, - key.is_dynamic: 1, - key.effective_access: source.decl.effective_access.internal + key.is_dynamic: 1 }, { key.kind: source.lang.swift.decl.function.accessor.setter, @@ -1586,8 +1565,7 @@ key.usr: , key.line: 178, key.column: 5, - key.is_dynamic: 1, - key.effective_access: source.decl.effective_access.internal + key.is_dynamic: 1 }, { key.kind: source.lang.swift.decl.function.accessor.getter, @@ -1595,8 +1573,7 @@ key.usr: , key.line: 179, key.column: 5, - key.is_dynamic: 1, - key.effective_access: source.decl.effective_access.internal + key.is_dynamic: 1 } ], key.effective_access: source.decl.effective_access.internal diff --git a/test/SourceKit/Indexing/index_bad_modulename.swift.response b/test/SourceKit/Indexing/index_bad_modulename.swift.response index 83f065b827e5a..f3477de5260a6 100644 --- a/test/SourceKit/Indexing/index_bad_modulename.swift.response +++ b/test/SourceKit/Indexing/index_bad_modulename.swift.response @@ -61,16 +61,14 @@ key.usr: "s:4main1vSo8NSObjectCSgvg", key.line: 9, key.column: 5, - key.is_implicit: 1, - key.effective_access: source.decl.effective_access.internal + key.is_implicit: 1 }, { key.kind: source.lang.swift.decl.function.accessor.setter, key.usr: "s:4main1vSo8NSObjectCSgvs", key.line: 9, key.column: 5, - key.is_implicit: 1, - key.effective_access: source.decl.effective_access.internal + key.is_implicit: 1 } ], key.effective_access: source.decl.effective_access.internal diff --git a/test/SourceKit/Indexing/index_big_array.swift.response b/test/SourceKit/Indexing/index_big_array.swift.response index 10c5e84a14af2..771e817e978e9 100644 --- a/test/SourceKit/Indexing/index_big_array.swift.response +++ b/test/SourceKit/Indexing/index_big_array.swift.response @@ -20,16 +20,14 @@ key.usr: "s:9big_array15gCubeVertexDataSaySfGvg", key.line: 1, key.column: 5, - key.is_implicit: 1, - key.effective_access: source.decl.effective_access.internal + key.is_implicit: 1 }, { key.kind: source.lang.swift.decl.function.accessor.setter, key.usr: "s:9big_array15gCubeVertexDataSaySfGvs", key.line: 1, key.column: 5, - key.is_implicit: 1, - key.effective_access: source.decl.effective_access.internal + key.is_implicit: 1 } ], key.effective_access: source.decl.effective_access.internal diff --git a/test/SourceKit/Indexing/index_constructors.swift.response b/test/SourceKit/Indexing/index_constructors.swift.response index cfb0ad914539d..186a1efaea342 100644 --- a/test/SourceKit/Indexing/index_constructors.swift.response +++ b/test/SourceKit/Indexing/index_constructors.swift.response @@ -51,8 +51,7 @@ key.line: 9, key.column: 7, key.is_dynamic: 1, - key.is_implicit: 1, - key.effective_access: source.decl.effective_access.internal + key.is_implicit: 1 }, { key.kind: source.lang.swift.decl.function.accessor.setter, @@ -60,8 +59,7 @@ key.line: 9, key.column: 7, key.is_dynamic: 1, - key.is_implicit: 1, - key.effective_access: source.decl.effective_access.internal + key.is_implicit: 1 } ], key.effective_access: source.decl.effective_access.internal diff --git a/test/SourceKit/Indexing/index_effective_access_level.swift b/test/SourceKit/Indexing/index_effective_access_level.swift index dc9a0fe1319a2..e3485b668925d 100644 --- a/test/SourceKit/Indexing/index_effective_access_level.swift +++ b/test/SourceKit/Indexing/index_effective_access_level.swift @@ -49,6 +49,29 @@ private extension PrivateEnum { func methodFromPrivateExtension() {} } +@propertyWrapper +public struct PublicPropertyWrapper { + public var wrappedValue: T + public init(wrappedValue: T) { + self.wrappedValue = wrappedValue + } +} + +@propertyWrapper +struct InternalPropertyWrapper { + let wrappedValue: T +} + +@propertyWrapper +fileprivate struct FilePrivatePropertyWrapper { + fileprivate let wrappedValue: T +} + +@propertyWrapper +private struct PrivatePropertyWrapper { + private let wrappedValue: T +} + private struct ScopeReducerStruct { public init(publicInitializer: Int) {} init(internalInitializer: Int) {} @@ -61,6 +84,11 @@ private struct ScopeReducerStruct { private let privateProperty: Int = 0 public private(set) var publicPropertyWithPrivateSetter: Int = 0 + @PublicPropertyWrapper public var publicPropertyWrappedProperty: Int = 0 + @PublicPropertyWrapper var internalPropertyWrappedProperty: Int = 0 + @PublicPropertyWrapper fileprivate var filePrivatePropertyWrappedProperty: Int = 0 + @PublicPropertyWrapper private var privatePropertyWrappedProperty: Int = 0 + public subscript(publicSubscript: Int) -> Int { return 0 } subscript(internalSubscript: Int) -> Int { return 0 } fileprivate subscript(filePrivateSubscript: Int) -> Int { return 0 } @@ -84,6 +112,11 @@ public struct ScopeKeeperStruct { private let privateProperty: Int = 0 public private(set) var publicPropertyWithPrivateSetter: Int = 0 + @PublicPropertyWrapper public var publicPropertyWrappedProperty: Int = 0 + @PublicPropertyWrapper var internalPropertyWrappedProperty: Int = 0 + @PublicPropertyWrapper fileprivate var filePrivatePropertyWrappedProperty: Int = 0 + @PublicPropertyWrapper private var privatePropertyWrappedProperty: Int = 0 + public subscript(publicSubscript: Int) -> Int { return 0 } subscript(internalSubscript: Int) -> Int { return 0 } fileprivate subscript(filePrivateSubscript: Int) -> Int { return 0 } @@ -107,6 +140,11 @@ struct PartialScopeReducerStruct { private let privateProperty: Int = 0 public private(set) var publicPropertyWithPrivateSetter: Int = 0 + @PublicPropertyWrapper public var publicPropertyWrappedProperty: Int = 0 + @PublicPropertyWrapper var internalPropertyWrappedProperty: Int = 0 + @PublicPropertyWrapper fileprivate var filePrivatePropertyWrappedProperty: Int = 0 + @PublicPropertyWrapper private var privatePropertyWrappedProperty: Int = 0 + public subscript(publicSubscript: Int) -> Int { return 0 } subscript(internalSubscript: Int) -> Int { return 0 } fileprivate subscript(filePrivateSubscript: Int) -> Int { return 0 } diff --git a/test/SourceKit/Indexing/index_effective_access_level.swift.response b/test/SourceKit/Indexing/index_effective_access_level.swift.response index 221e27418219b..668baf133eb0c 100644 --- a/test/SourceKit/Indexing/index_effective_access_level.swift.response +++ b/test/SourceKit/Indexing/index_effective_access_level.swift.response @@ -354,25 +354,358 @@ } ] }, + { + key.kind: source.lang.swift.decl.struct, + key.name: "PublicPropertyWrapper", + key.usr: "s:28index_effective_access_level21PublicPropertyWrapperV", + key.line: 53, + key.column: 15, + key.entities: [ + { + key.kind: source.lang.swift.decl.generic_type_param, + key.name: "T", + key.usr: "s:28index_effective_access_level21PublicPropertyWrapperV1Txmfp", + key.line: 53, + key.column: 37, + key.effective_access: source.decl.effective_access.internal + }, + { + key.kind: source.lang.swift.decl.var.instance, + key.name: "wrappedValue", + key.usr: "s:28index_effective_access_level21PublicPropertyWrapperV12wrappedValuexvp", + key.line: 54, + key.column: 16, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.usr: "s:28index_effective_access_level21PublicPropertyWrapperV12wrappedValuexvg", + key.line: 54, + key.column: 16, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.public + } + ] + }, + { + key.kind: source.lang.swift.decl.function.accessor.setter, + key.usr: "s:28index_effective_access_level21PublicPropertyWrapperV12wrappedValuexvs", + key.line: 54, + key.column: 16, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.public + } + ] + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.public + } + ], + key.effective_access: source.decl.effective_access.public + }, + { + key.kind: source.lang.swift.ref.generic_type_param, + key.name: "T", + key.usr: "s:28index_effective_access_level21PublicPropertyWrapperV1Txmfp", + key.line: 54, + key.column: 30 + }, + { + key.kind: source.lang.swift.decl.function.constructor, + key.name: "init(wrappedValue:)", + key.usr: "s:28index_effective_access_level21PublicPropertyWrapperV12wrappedValueACyxGx_tcfc", + key.line: 55, + key.column: 12, + key.entities: [ + { + key.kind: source.lang.swift.ref.generic_type_param, + key.name: "T", + key.usr: "s:28index_effective_access_level21PublicPropertyWrapperV1Txmfp", + key.line: 55, + key.column: 31 + }, + { + key.kind: source.lang.swift.ref.var.instance, + key.name: "wrappedValue", + key.usr: "s:28index_effective_access_level21PublicPropertyWrapperV12wrappedValuexvp", + key.line: 56, + key.column: 14, + key.entities: [ + { + key.kind: source.lang.swift.ref.function.accessor.setter, + key.usr: "s:28index_effective_access_level21PublicPropertyWrapperV12wrappedValuexvs", + key.line: 56, + key.column: 14, + key.receiver_usr: "s:28index_effective_access_level21PublicPropertyWrapperV", + key.is_implicit: 1 + } + ] + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.public + } + ], + key.effective_access: source.decl.effective_access.public + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.public + }, + { + key.attribute: source.decl.attribute.propertyWrapper + } + ], + key.effective_access: source.decl.effective_access.public + }, + { + key.kind: source.lang.swift.decl.struct, + key.name: "InternalPropertyWrapper", + key.usr: "s:28index_effective_access_level23InternalPropertyWrapperV", + key.line: 61, + key.column: 8, + key.entities: [ + { + key.kind: source.lang.swift.decl.generic_type_param, + key.name: "T", + key.usr: "s:28index_effective_access_level23InternalPropertyWrapperV1Txmfp", + key.line: 61, + key.column: 32, + key.effective_access: source.decl.effective_access.internal + }, + { + key.kind: source.lang.swift.decl.var.instance, + key.name: "wrappedValue", + key.usr: "s:28index_effective_access_level23InternalPropertyWrapperV12wrappedValuexvp", + key.line: 62, + key.column: 9, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.usr: "s:28index_effective_access_level23InternalPropertyWrapperV12wrappedValuexvg", + key.line: 62, + key.column: 9, + key.is_implicit: 1 + }, + { + key.kind: source.lang.swift.decl.function.accessor.setter, + key.usr: "s:28index_effective_access_level23InternalPropertyWrapperV12wrappedValuexvs", + key.line: 62, + key.column: 9, + key.is_implicit: 1 + } + ], + key.effective_access: source.decl.effective_access.internal + }, + { + key.kind: source.lang.swift.ref.generic_type_param, + key.name: "T", + key.usr: "s:28index_effective_access_level23InternalPropertyWrapperV1Txmfp", + key.line: 62, + key.column: 23 + }, + { + key.kind: source.lang.swift.decl.function.constructor, + key.usr: "s:28index_effective_access_level23InternalPropertyWrapperV12wrappedValueACyxGx_tcfc", + key.line: 61, + key.column: 8, + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.internal + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.propertyWrapper + } + ], + key.effective_access: source.decl.effective_access.internal + }, + { + key.kind: source.lang.swift.decl.struct, + key.name: "FilePrivatePropertyWrapper", + key.usr: "s:28index_effective_access_level26FilePrivatePropertyWrapper33_2295DDF1454D6A6D9229E8222CD85214LLV", + key.line: 66, + key.column: 20, + key.entities: [ + { + key.kind: source.lang.swift.decl.generic_type_param, + key.name: "T", + key.usr: "s:28index_effective_access_level26FilePrivatePropertyWrapper33_2295DDF1454D6A6D9229E8222CD85214LLV1Txmfp", + key.line: 66, + key.column: 47, + key.effective_access: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.decl.var.instance, + key.name: "wrappedValue", + key.usr: "s:28index_effective_access_level26FilePrivatePropertyWrapper33_2295DDF1454D6A6D9229E8222CD85214LLV12wrappedValuexvp", + key.line: 67, + key.column: 21, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.usr: "s:28index_effective_access_level26FilePrivatePropertyWrapper33_2295DDF1454D6A6D9229E8222CD85214LLV12wrappedValuexvg", + key.line: 67, + key.column: 21, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.fileprivate + } + ] + }, + { + key.kind: source.lang.swift.decl.function.accessor.setter, + key.usr: "s:28index_effective_access_level26FilePrivatePropertyWrapper33_2295DDF1454D6A6D9229E8222CD85214LLV12wrappedValuexvs", + key.line: 67, + key.column: 21, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.fileprivate + } + ] + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.fileprivate + } + ], + key.effective_access: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.ref.generic_type_param, + key.name: "T", + key.usr: "s:28index_effective_access_level26FilePrivatePropertyWrapper33_2295DDF1454D6A6D9229E8222CD85214LLV1Txmfp", + key.line: 67, + key.column: 35 + }, + { + key.kind: source.lang.swift.decl.function.constructor, + key.usr: "s:28index_effective_access_level26FilePrivatePropertyWrapper33_2295DDF1454D6A6D9229E8222CD85214LLV12wrappedValueADyxGx_tcfc", + key.line: 66, + key.column: 20, + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.fileprivate + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.fileprivate + }, + { + key.attribute: source.decl.attribute.propertyWrapper + } + ], + key.effective_access: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.decl.struct, + key.name: "PrivatePropertyWrapper", + key.usr: "s:28index_effective_access_level22PrivatePropertyWrapper33_2295DDF1454D6A6D9229E8222CD85214LLV", + key.line: 71, + key.column: 16, + key.entities: [ + { + key.kind: source.lang.swift.decl.generic_type_param, + key.name: "T", + key.usr: "s:28index_effective_access_level22PrivatePropertyWrapper33_2295DDF1454D6A6D9229E8222CD85214LLV1Txmfp", + key.line: 71, + key.column: 39, + key.effective_access: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.decl.var.instance, + key.name: "wrappedValue", + key.usr: "s:28index_effective_access_level22PrivatePropertyWrapper33_2295DDF1454D6A6D9229E8222CD85214LLV12wrappedValuexvp", + key.line: 72, + key.column: 17, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.usr: "s:28index_effective_access_level22PrivatePropertyWrapper33_2295DDF1454D6A6D9229E8222CD85214LLV12wrappedValuexvg", + key.line: 72, + key.column: 17, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.private + } + ] + }, + { + key.kind: source.lang.swift.decl.function.accessor.setter, + key.usr: "s:28index_effective_access_level22PrivatePropertyWrapper33_2295DDF1454D6A6D9229E8222CD85214LLV12wrappedValuexvs", + key.line: 72, + key.column: 17, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.private + } + ] + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.private + } + ], + key.effective_access: source.decl.effective_access.less_than_fileprivate + }, + { + key.kind: source.lang.swift.ref.generic_type_param, + key.name: "T", + key.usr: "s:28index_effective_access_level22PrivatePropertyWrapper33_2295DDF1454D6A6D9229E8222CD85214LLV1Txmfp", + key.line: 72, + key.column: 31 + }, + { + key.kind: source.lang.swift.decl.function.constructor, + key.usr: "s:28index_effective_access_level22PrivatePropertyWrapper33_2295DDF1454D6A6D9229E8222CD85214LLV12wrappedValueADyxGx_tcfc", + key.line: 71, + key.column: 16, + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.less_than_fileprivate + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.private + }, + { + key.attribute: source.decl.attribute.propertyWrapper + } + ], + key.effective_access: source.decl.effective_access.fileprivate + }, { key.kind: source.lang.swift.decl.struct, key.name: "ScopeReducerStruct", key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV", - key.line: 52, + key.line: 75, key.column: 16, key.entities: [ { key.kind: source.lang.swift.decl.function.constructor, key.name: "init(publicInitializer:)", key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV17publicInitializerADSi_tcfc", - key.line: 53, + key.line: 76, key.column: 12, key.entities: [ { key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 53, + key.line: 76, key.column: 36 } ], @@ -387,14 +720,14 @@ key.kind: source.lang.swift.decl.function.constructor, key.name: "init(internalInitializer:)", key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV19internalInitializerADSi_tcfc", - key.line: 54, + key.line: 77, key.column: 5, key.entities: [ { key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 54, + key.line: 77, key.column: 31 } ], @@ -404,14 +737,14 @@ key.kind: source.lang.swift.decl.function.constructor, key.name: "init(filePrivateInitializer:)", key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV22filePrivateInitializerADSi_tcfc", - key.line: 55, + key.line: 78, key.column: 17, key.entities: [ { key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 55, + key.line: 78, key.column: 46 } ], @@ -426,14 +759,14 @@ key.kind: source.lang.swift.decl.function.constructor, key.name: "init(privateInitializer:)", key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV18privateInitializerADSi_tcfc", - key.line: 56, + key.line: 79, key.column: 13, key.entities: [ { key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 56, + key.line: 79, key.column: 38 } ], @@ -448,34 +781,32 @@ key.kind: source.lang.swift.decl.var.instance, key.name: "publicProperty", key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV14publicPropertySivp", - key.line: 58, + key.line: 81, key.column: 16, key.entities: [ { key.kind: source.lang.swift.decl.function.accessor.getter, key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV14publicPropertySivg", - key.line: 58, + key.line: 81, key.column: 16, key.is_implicit: 1, key.attributes: [ { key.attribute: source.decl.attribute.public } - ], - key.effective_access: source.decl.effective_access.fileprivate + ] }, { key.kind: source.lang.swift.decl.function.accessor.setter, key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV14publicPropertySivs", - key.line: 58, + key.line: 81, key.column: 16, key.is_implicit: 1, key.attributes: [ { key.attribute: source.decl.attribute.public } - ], - key.effective_access: source.decl.effective_access.fileprivate + ] } ], key.attributes: [ @@ -489,31 +820,29 @@ key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 58, + key.line: 81, key.column: 32 }, { key.kind: source.lang.swift.decl.var.instance, key.name: "internalProperty", key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV16internalPropertySivp", - key.line: 59, + key.line: 82, key.column: 9, key.entities: [ { key.kind: source.lang.swift.decl.function.accessor.getter, key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV16internalPropertySivg", - key.line: 59, + key.line: 82, key.column: 9, - key.is_implicit: 1, - key.effective_access: source.decl.effective_access.fileprivate + key.is_implicit: 1 }, { key.kind: source.lang.swift.decl.function.accessor.setter, key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV16internalPropertySivs", - key.line: 59, + key.line: 82, key.column: 9, - key.is_implicit: 1, - key.effective_access: source.decl.effective_access.fileprivate + key.is_implicit: 1 } ], key.effective_access: source.decl.effective_access.fileprivate @@ -522,41 +851,39 @@ key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 59, + key.line: 82, key.column: 27 }, { key.kind: source.lang.swift.decl.var.instance, key.name: "filePrivateProperty", key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV19filePrivatePropertySivp", - key.line: 60, + key.line: 83, key.column: 21, key.entities: [ { key.kind: source.lang.swift.decl.function.accessor.getter, key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV19filePrivatePropertySivg", - key.line: 60, + key.line: 83, key.column: 21, key.is_implicit: 1, key.attributes: [ { key.attribute: source.decl.attribute.fileprivate } - ], - key.effective_access: source.decl.effective_access.fileprivate + ] }, { key.kind: source.lang.swift.decl.function.accessor.setter, key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV19filePrivatePropertySivs", - key.line: 60, + key.line: 83, key.column: 21, key.is_implicit: 1, key.attributes: [ { key.attribute: source.decl.attribute.fileprivate } - ], - key.effective_access: source.decl.effective_access.fileprivate + ] } ], key.attributes: [ @@ -570,41 +897,39 @@ key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 60, + key.line: 83, key.column: 42 }, { key.kind: source.lang.swift.decl.var.instance, key.name: "privateProperty", key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV15privatePropertySivp", - key.line: 61, + key.line: 84, key.column: 17, key.entities: [ { key.kind: source.lang.swift.decl.function.accessor.getter, key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV15privatePropertySivg", - key.line: 61, + key.line: 84, key.column: 17, key.is_implicit: 1, key.attributes: [ { key.attribute: source.decl.attribute.private } - ], - key.effective_access: source.decl.effective_access.less_than_fileprivate + ] }, { key.kind: source.lang.swift.decl.function.accessor.setter, key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV15privatePropertySivs", - key.line: 61, + key.line: 84, key.column: 17, key.is_implicit: 1, key.attributes: [ { key.attribute: source.decl.attribute.private } - ], - key.effective_access: source.decl.effective_access.less_than_fileprivate + ] } ], key.attributes: [ @@ -618,20 +943,20 @@ key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 61, + key.line: 84, key.column: 34 }, { key.kind: source.lang.swift.decl.var.instance, key.name: "publicPropertyWithPrivateSetter", key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV31publicPropertyWithPrivateSetterSivp", - key.line: 62, + key.line: 85, key.column: 29, key.entities: [ { key.kind: source.lang.swift.decl.function.accessor.getter, key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV31publicPropertyWithPrivateSetterSivg", - key.line: 62, + key.line: 85, key.column: 29, key.is_implicit: 1, key.attributes: [ @@ -641,13 +966,12 @@ { key.attribute: source.decl.attribute.public } - ], - key.effective_access: source.decl.effective_access.fileprivate + ] }, { key.kind: source.lang.swift.decl.function.accessor.setter, key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV31publicPropertyWithPrivateSetterSivs", - key.line: 62, + key.line: 85, key.column: 29, key.is_implicit: 1, key.attributes: [ @@ -655,56 +979,321 @@ key.attribute: source.decl.attribute.setter_access.private }, { - key.attribute: source.decl.attribute.public + key.attribute: source.decl.attribute.public + } + ] + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.setter_access.private + }, + { + key.attribute: source.decl.attribute.public + } + ], + key.effective_access: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 85, + key.column: 62 + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "PublicPropertyWrapper", + key.usr: "s:28index_effective_access_level21PublicPropertyWrapperV", + key.line: 87, + key.column: 6 + }, + { + key.kind: source.lang.swift.ref.function.constructor, + key.usr: "s:28index_effective_access_level21PublicPropertyWrapperV12wrappedValueACyxGx_tcfc", + key.line: 87, + key.column: 6, + key.is_implicit: 1 + }, + { + key.kind: source.lang.swift.decl.var.instance, + key.name: "publicPropertyWrappedProperty", + key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV021publicPropertyWrappedO0Sivp", + key.line: 87, + key.column: 39, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV021publicPropertyWrappedO0Sivg", + key.line: 87, + key.column: 39, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.public + }, + { + key.attribute: source.decl.attribute._custom + } + ] + }, + { + key.kind: source.lang.swift.decl.function.accessor.setter, + key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV021publicPropertyWrappedO0Sivs", + key.line: 87, + key.column: 39, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.public + }, + { + key.attribute: source.decl.attribute._custom + } + ] + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.public + }, + { + key.attribute: source.decl.attribute._custom + } + ], + key.effective_access: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 87, + key.column: 70 + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "PublicPropertyWrapper", + key.usr: "s:28index_effective_access_level21PublicPropertyWrapperV", + key.line: 88, + key.column: 6 + }, + { + key.kind: source.lang.swift.ref.function.constructor, + key.usr: "s:28index_effective_access_level21PublicPropertyWrapperV12wrappedValueACyxGx_tcfc", + key.line: 88, + key.column: 6, + key.is_implicit: 1 + }, + { + key.kind: source.lang.swift.decl.var.instance, + key.name: "internalPropertyWrappedProperty", + key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV023internalPropertyWrappedO0Sivp", + key.line: 88, + key.column: 32, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV023internalPropertyWrappedO0Sivg", + key.line: 88, + key.column: 32, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute._custom + } + ] + }, + { + key.kind: source.lang.swift.decl.function.accessor.setter, + key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV023internalPropertyWrappedO0Sivs", + key.line: 88, + key.column: 32, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute._custom + } + ] + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute._custom + } + ], + key.effective_access: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 88, + key.column: 65 + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "PublicPropertyWrapper", + key.usr: "s:28index_effective_access_level21PublicPropertyWrapperV", + key.line: 89, + key.column: 6 + }, + { + key.kind: source.lang.swift.ref.function.constructor, + key.usr: "s:28index_effective_access_level21PublicPropertyWrapperV12wrappedValueACyxGx_tcfc", + key.line: 89, + key.column: 6, + key.is_implicit: 1 + }, + { + key.kind: source.lang.swift.decl.var.instance, + key.name: "filePrivatePropertyWrappedProperty", + key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV026filePrivatePropertyWrappedP0Sivp", + key.line: 89, + key.column: 44, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV026filePrivatePropertyWrappedP0Sivg", + key.line: 89, + key.column: 44, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.fileprivate + }, + { + key.attribute: source.decl.attribute._custom + } + ] + }, + { + key.kind: source.lang.swift.decl.function.accessor.setter, + key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV026filePrivatePropertyWrappedP0Sivs", + key.line: 89, + key.column: 44, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.fileprivate + }, + { + key.attribute: source.decl.attribute._custom + } + ] + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.fileprivate + }, + { + key.attribute: source.decl.attribute._custom + } + ], + key.effective_access: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 89, + key.column: 80 + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "PublicPropertyWrapper", + key.usr: "s:28index_effective_access_level21PublicPropertyWrapperV", + key.line: 90, + key.column: 6 + }, + { + key.kind: source.lang.swift.ref.function.constructor, + key.usr: "s:28index_effective_access_level21PublicPropertyWrapperV12wrappedValueACyxGx_tcfc", + key.line: 90, + key.column: 6, + key.is_implicit: 1 + }, + { + key.kind: source.lang.swift.decl.var.instance, + key.name: "privatePropertyWrappedProperty", + key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV022privatePropertyWrappedO0Sivp", + key.line: 90, + key.column: 40, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV022privatePropertyWrappedO0Sivg", + key.line: 90, + key.column: 40, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.private + }, + { + key.attribute: source.decl.attribute._custom + } + ] + }, + { + key.kind: source.lang.swift.decl.function.accessor.setter, + key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV022privatePropertyWrappedO0Sivs", + key.line: 90, + key.column: 40, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.private + }, + { + key.attribute: source.decl.attribute._custom } - ], - key.effective_access: source.decl.effective_access.fileprivate + ] } ], key.attributes: [ { - key.attribute: source.decl.attribute.setter_access.private + key.attribute: source.decl.attribute.private }, { - key.attribute: source.decl.attribute.public + key.attribute: source.decl.attribute._custom } ], - key.effective_access: source.decl.effective_access.fileprivate + key.effective_access: source.decl.effective_access.less_than_fileprivate }, { key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 62, - key.column: 62 + key.line: 90, + key.column: 72 }, { key.kind: source.lang.swift.decl.function.subscript, key.name: "subscript(_:)", key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLVyS2icip", - key.line: 64, + key.line: 92, key.column: 12, key.entities: [ { key.kind: source.lang.swift.decl.function.accessor.getter, key.name: "getter:subscript(_:)", key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLVyS2icig", - key.line: 64, - key.column: 51, - key.effective_access: source.decl.effective_access.fileprivate + key.line: 92, + key.column: 51 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 64, + key.line: 92, key.column: 39 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 64, + key.line: 92, key.column: 47 } ], @@ -719,29 +1308,28 @@ key.kind: source.lang.swift.decl.function.subscript, key.name: "subscript(_:)", key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLVXeip", - key.line: 65, + key.line: 93, key.column: 5, key.entities: [ { key.kind: source.lang.swift.decl.function.accessor.getter, key.name: "getter:subscript(_:)", key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLVXeig", - key.line: 65, - key.column: 46, - key.effective_access: source.decl.effective_access.fileprivate + key.line: 93, + key.column: 46 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 65, + key.line: 93, key.column: 34 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 65, + key.line: 93, key.column: 42 } ], @@ -751,29 +1339,28 @@ key.kind: source.lang.swift.decl.function.subscript, key.name: "subscript(_:)", key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLVXeip", - key.line: 66, + key.line: 94, key.column: 17, key.entities: [ { key.kind: source.lang.swift.decl.function.accessor.getter, key.name: "getter:subscript(_:)", key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLVXeig", - key.line: 66, - key.column: 61, - key.effective_access: source.decl.effective_access.fileprivate + key.line: 94, + key.column: 61 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 66, + key.line: 94, key.column: 49 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 66, + key.line: 94, key.column: 57 } ], @@ -788,29 +1375,28 @@ key.kind: source.lang.swift.decl.function.subscript, key.name: "subscript(_:)", key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLVXeip", - key.line: 67, + key.line: 95, key.column: 13, key.entities: [ { key.kind: source.lang.swift.decl.function.accessor.getter, key.name: "getter:subscript(_:)", key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLVXeig", - key.line: 67, - key.column: 53, - key.effective_access: source.decl.effective_access.less_than_fileprivate + key.line: 95, + key.column: 53 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 67, + key.line: 95, key.column: 41 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 67, + key.line: 95, key.column: 49 } ], @@ -825,7 +1411,7 @@ key.kind: source.lang.swift.decl.function.method.instance, key.name: "publicMethod()", key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV12publicMethodyyF", - key.line: 69, + key.line: 97, key.column: 17, key.attributes: [ { @@ -838,7 +1424,7 @@ key.kind: source.lang.swift.decl.function.method.instance, key.name: "internalMethod()", key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV14internalMethodyyF", - key.line: 70, + key.line: 98, key.column: 10, key.effective_access: source.decl.effective_access.fileprivate }, @@ -846,7 +1432,7 @@ key.kind: source.lang.swift.decl.function.method.instance, key.name: "filePrivateMethod()", key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV17filePrivateMethodyyF", - key.line: 71, + key.line: 99, key.column: 22, key.attributes: [ { @@ -859,7 +1445,7 @@ key.kind: source.lang.swift.decl.function.method.instance, key.name: "privateMethod()", key.usr: "s:28index_effective_access_level18ScopeReducerStruct33_2295DDF1454D6A6D9229E8222CD85214LLV13privateMethodyyF", - key.line: 72, + key.line: 100, key.column: 18, key.attributes: [ { @@ -880,21 +1466,21 @@ key.kind: source.lang.swift.decl.struct, key.name: "ScopeKeeperStruct", key.usr: "s:28index_effective_access_level17ScopeKeeperStructV", - key.line: 75, + key.line: 103, key.column: 15, key.entities: [ { key.kind: source.lang.swift.decl.function.constructor, key.name: "init(publicInitializer:)", key.usr: "s:28index_effective_access_level17ScopeKeeperStructV17publicInitializerACSi_tcfc", - key.line: 76, + key.line: 104, key.column: 12, key.entities: [ { key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 76, + key.line: 104, key.column: 36 } ], @@ -909,14 +1495,14 @@ key.kind: source.lang.swift.decl.function.constructor, key.name: "init(internalInitializer:)", key.usr: "s:28index_effective_access_level17ScopeKeeperStructV19internalInitializerACSi_tcfc", - key.line: 77, + key.line: 105, key.column: 5, key.entities: [ { key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 77, + key.line: 105, key.column: 31 } ], @@ -926,14 +1512,14 @@ key.kind: source.lang.swift.decl.function.constructor, key.name: "init(filePrivateInitializer:)", key.usr: "s:28index_effective_access_level17ScopeKeeperStructV22filePrivateInitializerACSi_tc33_2295DDF1454D6A6D9229E8222CD85214Llfc", - key.line: 78, + key.line: 106, key.column: 17, key.entities: [ { key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 78, + key.line: 106, key.column: 46 } ], @@ -948,14 +1534,14 @@ key.kind: source.lang.swift.decl.function.constructor, key.name: "init(privateInitializer:)", key.usr: "s:28index_effective_access_level17ScopeKeeperStructV18privateInitializerACSi_tc33_2295DDF1454D6A6D9229E8222CD85214Llfc", - key.line: 79, + key.line: 107, key.column: 13, key.entities: [ { key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 79, + key.line: 107, key.column: 38 } ], @@ -970,34 +1556,32 @@ key.kind: source.lang.swift.decl.var.instance, key.name: "publicProperty", key.usr: "s:28index_effective_access_level17ScopeKeeperStructV14publicPropertySivp", - key.line: 81, + key.line: 109, key.column: 16, key.entities: [ { key.kind: source.lang.swift.decl.function.accessor.getter, key.usr: "s:28index_effective_access_level17ScopeKeeperStructV14publicPropertySivg", - key.line: 81, + key.line: 109, key.column: 16, key.is_implicit: 1, key.attributes: [ { key.attribute: source.decl.attribute.public } - ], - key.effective_access: source.decl.effective_access.public + ] }, { key.kind: source.lang.swift.decl.function.accessor.setter, key.usr: "s:28index_effective_access_level17ScopeKeeperStructV14publicPropertySivs", - key.line: 81, + key.line: 109, key.column: 16, key.is_implicit: 1, key.attributes: [ { key.attribute: source.decl.attribute.public } - ], - key.effective_access: source.decl.effective_access.public + ] } ], key.attributes: [ @@ -1011,31 +1595,29 @@ key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 81, + key.line: 109, key.column: 32 }, { key.kind: source.lang.swift.decl.var.instance, key.name: "internalProperty", key.usr: "s:28index_effective_access_level17ScopeKeeperStructV16internalPropertySivp", - key.line: 82, + key.line: 110, key.column: 9, key.entities: [ { key.kind: source.lang.swift.decl.function.accessor.getter, key.usr: "s:28index_effective_access_level17ScopeKeeperStructV16internalPropertySivg", - key.line: 82, + key.line: 110, key.column: 9, - key.is_implicit: 1, - key.effective_access: source.decl.effective_access.internal + key.is_implicit: 1 }, { key.kind: source.lang.swift.decl.function.accessor.setter, key.usr: "s:28index_effective_access_level17ScopeKeeperStructV16internalPropertySivs", - key.line: 82, + key.line: 110, key.column: 9, - key.is_implicit: 1, - key.effective_access: source.decl.effective_access.internal + key.is_implicit: 1 } ], key.effective_access: source.decl.effective_access.internal @@ -1044,189 +1626,449 @@ key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 82, + key.line: 110, key.column: 27 }, { key.kind: source.lang.swift.decl.var.instance, key.name: "filePrivateProperty", key.usr: "s:28index_effective_access_level17ScopeKeeperStructV19filePrivateProperty33_2295DDF1454D6A6D9229E8222CD85214LLSivp", - key.line: 83, + key.line: 111, key.column: 21, key.entities: [ { key.kind: source.lang.swift.decl.function.accessor.getter, - key.usr: "s:28index_effective_access_level17ScopeKeeperStructV19filePrivateProperty33_2295DDF1454D6A6D9229E8222CD85214LLSivg", - key.line: 83, - key.column: 21, + key.usr: "s:28index_effective_access_level17ScopeKeeperStructV19filePrivateProperty33_2295DDF1454D6A6D9229E8222CD85214LLSivg", + key.line: 111, + key.column: 21, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.fileprivate + } + ] + }, + { + key.kind: source.lang.swift.decl.function.accessor.setter, + key.usr: "s:28index_effective_access_level17ScopeKeeperStructV19filePrivateProperty33_2295DDF1454D6A6D9229E8222CD85214LLSivs", + key.line: 111, + key.column: 21, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.fileprivate + } + ] + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.fileprivate + } + ], + key.effective_access: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 111, + key.column: 42 + }, + { + key.kind: source.lang.swift.decl.var.instance, + key.name: "privateProperty", + key.usr: "s:28index_effective_access_level17ScopeKeeperStructV15privateProperty33_2295DDF1454D6A6D9229E8222CD85214LLSivp", + key.line: 112, + key.column: 17, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.usr: "s:28index_effective_access_level17ScopeKeeperStructV15privateProperty33_2295DDF1454D6A6D9229E8222CD85214LLSivg", + key.line: 112, + key.column: 17, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.private + } + ] + }, + { + key.kind: source.lang.swift.decl.function.accessor.setter, + key.usr: "s:28index_effective_access_level17ScopeKeeperStructV15privateProperty33_2295DDF1454D6A6D9229E8222CD85214LLSivs", + key.line: 112, + key.column: 17, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.private + } + ] + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.private + } + ], + key.effective_access: source.decl.effective_access.less_than_fileprivate + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 112, + key.column: 34 + }, + { + key.kind: source.lang.swift.decl.var.instance, + key.name: "publicPropertyWithPrivateSetter", + key.usr: "s:28index_effective_access_level17ScopeKeeperStructV31publicPropertyWithPrivateSetterSivp", + key.line: 113, + key.column: 29, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.usr: "s:28index_effective_access_level17ScopeKeeperStructV31publicPropertyWithPrivateSetterSivg", + key.line: 113, + key.column: 29, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.setter_access.private + }, + { + key.attribute: source.decl.attribute.public + } + ] + }, + { + key.kind: source.lang.swift.decl.function.accessor.setter, + key.usr: "s:28index_effective_access_level17ScopeKeeperStructV31publicPropertyWithPrivateSetterSivs", + key.line: 113, + key.column: 29, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.setter_access.private + }, + { + key.attribute: source.decl.attribute.public + } + ] + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.setter_access.private + }, + { + key.attribute: source.decl.attribute.public + } + ], + key.effective_access: source.decl.effective_access.public + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 113, + key.column: 62 + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "PublicPropertyWrapper", + key.usr: "s:28index_effective_access_level21PublicPropertyWrapperV", + key.line: 115, + key.column: 6 + }, + { + key.kind: source.lang.swift.ref.function.constructor, + key.usr: "s:28index_effective_access_level21PublicPropertyWrapperV12wrappedValueACyxGx_tcfc", + key.line: 115, + key.column: 6, + key.is_implicit: 1 + }, + { + key.kind: source.lang.swift.decl.var.instance, + key.name: "publicPropertyWrappedProperty", + key.usr: "s:28index_effective_access_level17ScopeKeeperStructV021publicPropertyWrappedI0Sivp", + key.line: 115, + key.column: 39, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.usr: "s:28index_effective_access_level17ScopeKeeperStructV021publicPropertyWrappedI0Sivg", + key.line: 115, + key.column: 39, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.public + }, + { + key.attribute: source.decl.attribute._custom + } + ] + }, + { + key.kind: source.lang.swift.decl.function.accessor.setter, + key.usr: "s:28index_effective_access_level17ScopeKeeperStructV021publicPropertyWrappedI0Sivs", + key.line: 115, + key.column: 39, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.public + }, + { + key.attribute: source.decl.attribute._custom + } + ] + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.public + }, + { + key.attribute: source.decl.attribute._custom + } + ], + key.effective_access: source.decl.effective_access.public + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 115, + key.column: 70 + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "PublicPropertyWrapper", + key.usr: "s:28index_effective_access_level21PublicPropertyWrapperV", + key.line: 116, + key.column: 6 + }, + { + key.kind: source.lang.swift.ref.function.constructor, + key.usr: "s:28index_effective_access_level21PublicPropertyWrapperV12wrappedValueACyxGx_tcfc", + key.line: 116, + key.column: 6, + key.is_implicit: 1 + }, + { + key.kind: source.lang.swift.decl.var.instance, + key.name: "internalPropertyWrappedProperty", + key.usr: "s:28index_effective_access_level17ScopeKeeperStructV023internalPropertyWrappedI0Sivp", + key.line: 116, + key.column: 32, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.usr: "s:28index_effective_access_level17ScopeKeeperStructV023internalPropertyWrappedI0Sivg", + key.line: 116, + key.column: 32, key.is_implicit: 1, key.attributes: [ { - key.attribute: source.decl.attribute.fileprivate + key.attribute: source.decl.attribute._custom } - ], - key.effective_access: source.decl.effective_access.fileprivate + ] }, { key.kind: source.lang.swift.decl.function.accessor.setter, - key.usr: "s:28index_effective_access_level17ScopeKeeperStructV19filePrivateProperty33_2295DDF1454D6A6D9229E8222CD85214LLSivs", - key.line: 83, - key.column: 21, + key.usr: "s:28index_effective_access_level17ScopeKeeperStructV023internalPropertyWrappedI0Sivs", + key.line: 116, + key.column: 32, key.is_implicit: 1, key.attributes: [ { - key.attribute: source.decl.attribute.fileprivate + key.attribute: source.decl.attribute._custom } - ], - key.effective_access: source.decl.effective_access.fileprivate + ] } ], key.attributes: [ { - key.attribute: source.decl.attribute.fileprivate + key.attribute: source.decl.attribute._custom } ], - key.effective_access: source.decl.effective_access.fileprivate + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 83, - key.column: 42 + key.line: 116, + key.column: 65 + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "PublicPropertyWrapper", + key.usr: "s:28index_effective_access_level21PublicPropertyWrapperV", + key.line: 117, + key.column: 6 + }, + { + key.kind: source.lang.swift.ref.function.constructor, + key.usr: "s:28index_effective_access_level21PublicPropertyWrapperV12wrappedValueACyxGx_tcfc", + key.line: 117, + key.column: 6, + key.is_implicit: 1 }, { key.kind: source.lang.swift.decl.var.instance, - key.name: "privateProperty", - key.usr: "s:28index_effective_access_level17ScopeKeeperStructV15privateProperty33_2295DDF1454D6A6D9229E8222CD85214LLSivp", - key.line: 84, - key.column: 17, + key.name: "filePrivatePropertyWrappedProperty", + key.usr: "s:28index_effective_access_level17ScopeKeeperStructV026filePrivatePropertyWrappedJ033_2295DDF1454D6A6D9229E8222CD85214LLSivp", + key.line: 117, + key.column: 44, key.entities: [ { key.kind: source.lang.swift.decl.function.accessor.getter, - key.usr: "s:28index_effective_access_level17ScopeKeeperStructV15privateProperty33_2295DDF1454D6A6D9229E8222CD85214LLSivg", - key.line: 84, - key.column: 17, + key.usr: "s:28index_effective_access_level17ScopeKeeperStructV026filePrivatePropertyWrappedJ033_2295DDF1454D6A6D9229E8222CD85214LLSivg", + key.line: 117, + key.column: 44, key.is_implicit: 1, key.attributes: [ { - key.attribute: source.decl.attribute.private + key.attribute: source.decl.attribute.fileprivate + }, + { + key.attribute: source.decl.attribute._custom } - ], - key.effective_access: source.decl.effective_access.less_than_fileprivate + ] }, { key.kind: source.lang.swift.decl.function.accessor.setter, - key.usr: "s:28index_effective_access_level17ScopeKeeperStructV15privateProperty33_2295DDF1454D6A6D9229E8222CD85214LLSivs", - key.line: 84, - key.column: 17, + key.usr: "s:28index_effective_access_level17ScopeKeeperStructV026filePrivatePropertyWrappedJ033_2295DDF1454D6A6D9229E8222CD85214LLSivs", + key.line: 117, + key.column: 44, key.is_implicit: 1, key.attributes: [ { - key.attribute: source.decl.attribute.private + key.attribute: source.decl.attribute.fileprivate + }, + { + key.attribute: source.decl.attribute._custom } - ], - key.effective_access: source.decl.effective_access.less_than_fileprivate + ] } ], key.attributes: [ { - key.attribute: source.decl.attribute.private + key.attribute: source.decl.attribute.fileprivate + }, + { + key.attribute: source.decl.attribute._custom } ], - key.effective_access: source.decl.effective_access.less_than_fileprivate + key.effective_access: source.decl.effective_access.fileprivate }, { key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 84, - key.column: 34 + key.line: 117, + key.column: 80 + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "PublicPropertyWrapper", + key.usr: "s:28index_effective_access_level21PublicPropertyWrapperV", + key.line: 118, + key.column: 6 + }, + { + key.kind: source.lang.swift.ref.function.constructor, + key.usr: "s:28index_effective_access_level21PublicPropertyWrapperV12wrappedValueACyxGx_tcfc", + key.line: 118, + key.column: 6, + key.is_implicit: 1 }, { key.kind: source.lang.swift.decl.var.instance, - key.name: "publicPropertyWithPrivateSetter", - key.usr: "s:28index_effective_access_level17ScopeKeeperStructV31publicPropertyWithPrivateSetterSivp", - key.line: 85, - key.column: 29, + key.name: "privatePropertyWrappedProperty", + key.usr: "s:28index_effective_access_level17ScopeKeeperStructV022privatePropertyWrappedI033_2295DDF1454D6A6D9229E8222CD85214LLSivp", + key.line: 118, + key.column: 40, key.entities: [ { key.kind: source.lang.swift.decl.function.accessor.getter, - key.usr: "s:28index_effective_access_level17ScopeKeeperStructV31publicPropertyWithPrivateSetterSivg", - key.line: 85, - key.column: 29, + key.usr: "s:28index_effective_access_level17ScopeKeeperStructV022privatePropertyWrappedI033_2295DDF1454D6A6D9229E8222CD85214LLSivg", + key.line: 118, + key.column: 40, key.is_implicit: 1, key.attributes: [ { - key.attribute: source.decl.attribute.setter_access.private + key.attribute: source.decl.attribute.private }, { - key.attribute: source.decl.attribute.public + key.attribute: source.decl.attribute._custom } - ], - key.effective_access: source.decl.effective_access.public + ] }, { key.kind: source.lang.swift.decl.function.accessor.setter, - key.usr: "s:28index_effective_access_level17ScopeKeeperStructV31publicPropertyWithPrivateSetterSivs", - key.line: 85, - key.column: 29, + key.usr: "s:28index_effective_access_level17ScopeKeeperStructV022privatePropertyWrappedI033_2295DDF1454D6A6D9229E8222CD85214LLSivs", + key.line: 118, + key.column: 40, key.is_implicit: 1, key.attributes: [ { - key.attribute: source.decl.attribute.setter_access.private + key.attribute: source.decl.attribute.private }, { - key.attribute: source.decl.attribute.public + key.attribute: source.decl.attribute._custom } - ], - key.effective_access: source.decl.effective_access.public + ] } ], key.attributes: [ { - key.attribute: source.decl.attribute.setter_access.private + key.attribute: source.decl.attribute.private }, { - key.attribute: source.decl.attribute.public + key.attribute: source.decl.attribute._custom } ], - key.effective_access: source.decl.effective_access.public + key.effective_access: source.decl.effective_access.less_than_fileprivate }, { key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 85, - key.column: 62 + key.line: 118, + key.column: 72 }, { key.kind: source.lang.swift.decl.function.subscript, key.name: "subscript(_:)", key.usr: "s:28index_effective_access_level17ScopeKeeperStructVyS2icip", - key.line: 87, + key.line: 120, key.column: 12, key.entities: [ { key.kind: source.lang.swift.decl.function.accessor.getter, key.name: "getter:subscript(_:)", key.usr: "s:28index_effective_access_level17ScopeKeeperStructVyS2icig", - key.line: 87, - key.column: 51, - key.effective_access: source.decl.effective_access.public + key.line: 120, + key.column: 51 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 87, + key.line: 120, key.column: 39 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 87, + key.line: 120, key.column: 47 } ], @@ -1241,29 +2083,28 @@ key.kind: source.lang.swift.decl.function.subscript, key.name: "subscript(_:)", key.usr: "s:28index_effective_access_level17ScopeKeeperStructVXeip", - key.line: 88, + key.line: 121, key.column: 5, key.entities: [ { key.kind: source.lang.swift.decl.function.accessor.getter, key.name: "getter:subscript(_:)", key.usr: "s:28index_effective_access_level17ScopeKeeperStructVXeig", - key.line: 88, - key.column: 46, - key.effective_access: source.decl.effective_access.internal + key.line: 121, + key.column: 46 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 88, + key.line: 121, key.column: 34 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 88, + key.line: 121, key.column: 42 } ], @@ -1273,29 +2114,28 @@ key.kind: source.lang.swift.decl.function.subscript, key.name: "subscript(_:)", key.usr: "s:28index_effective_access_level17ScopeKeeperStructVXe33_2295DDF1454D6A6D9229E8222CD85214Llip", - key.line: 89, + key.line: 122, key.column: 17, key.entities: [ { key.kind: source.lang.swift.decl.function.accessor.getter, key.name: "getter:subscript(_:)", key.usr: "s:28index_effective_access_level17ScopeKeeperStructVXe33_2295DDF1454D6A6D9229E8222CD85214Llig", - key.line: 89, - key.column: 61, - key.effective_access: source.decl.effective_access.fileprivate + key.line: 122, + key.column: 61 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 89, + key.line: 122, key.column: 49 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 89, + key.line: 122, key.column: 57 } ], @@ -1310,29 +2150,28 @@ key.kind: source.lang.swift.decl.function.subscript, key.name: "subscript(_:)", key.usr: "s:28index_effective_access_level17ScopeKeeperStructVXe33_2295DDF1454D6A6D9229E8222CD85214Llip", - key.line: 90, + key.line: 123, key.column: 13, key.entities: [ { key.kind: source.lang.swift.decl.function.accessor.getter, key.name: "getter:subscript(_:)", key.usr: "s:28index_effective_access_level17ScopeKeeperStructVXe33_2295DDF1454D6A6D9229E8222CD85214Llig", - key.line: 90, - key.column: 53, - key.effective_access: source.decl.effective_access.less_than_fileprivate + key.line: 123, + key.column: 53 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 90, + key.line: 123, key.column: 41 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 90, + key.line: 123, key.column: 49 } ], @@ -1347,7 +2186,7 @@ key.kind: source.lang.swift.decl.function.method.instance, key.name: "publicMethod()", key.usr: "s:28index_effective_access_level17ScopeKeeperStructV12publicMethodyyF", - key.line: 92, + key.line: 125, key.column: 17, key.attributes: [ { @@ -1360,7 +2199,7 @@ key.kind: source.lang.swift.decl.function.method.instance, key.name: "internalMethod()", key.usr: "s:28index_effective_access_level17ScopeKeeperStructV14internalMethodyyF", - key.line: 93, + key.line: 126, key.column: 10, key.effective_access: source.decl.effective_access.internal }, @@ -1368,7 +2207,7 @@ key.kind: source.lang.swift.decl.function.method.instance, key.name: "filePrivateMethod()", key.usr: "s:28index_effective_access_level17ScopeKeeperStructV17filePrivateMethod33_2295DDF1454D6A6D9229E8222CD85214LLyyF", - key.line: 94, + key.line: 127, key.column: 22, key.attributes: [ { @@ -1381,7 +2220,7 @@ key.kind: source.lang.swift.decl.function.method.instance, key.name: "privateMethod()", key.usr: "s:28index_effective_access_level17ScopeKeeperStructV13privateMethod33_2295DDF1454D6A6D9229E8222CD85214LLyyF", - key.line: 95, + key.line: 128, key.column: 18, key.attributes: [ { @@ -1402,21 +2241,21 @@ key.kind: source.lang.swift.decl.struct, key.name: "PartialScopeReducerStruct", key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV", - key.line: 98, + key.line: 131, key.column: 8, key.entities: [ { key.kind: source.lang.swift.decl.function.constructor, key.name: "init(publicInitializer:)", key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV17publicInitializerACSi_tcfc", - key.line: 99, + key.line: 132, key.column: 12, key.entities: [ { key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 99, + key.line: 132, key.column: 36 } ], @@ -1431,14 +2270,14 @@ key.kind: source.lang.swift.decl.function.constructor, key.name: "init(internalInitializer:)", key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV19internalInitializerACSi_tcfc", - key.line: 100, + key.line: 133, key.column: 5, key.entities: [ { key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 100, + key.line: 133, key.column: 31 } ], @@ -1448,14 +2287,14 @@ key.kind: source.lang.swift.decl.function.constructor, key.name: "init(filePrivateInitializer:)", key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV22filePrivateInitializerACSi_tc33_2295DDF1454D6A6D9229E8222CD85214Llfc", - key.line: 101, + key.line: 134, key.column: 17, key.entities: [ { key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 101, + key.line: 134, key.column: 46 } ], @@ -1470,14 +2309,14 @@ key.kind: source.lang.swift.decl.function.constructor, key.name: "init(privateInitializer:)", key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV18privateInitializerACSi_tc33_2295DDF1454D6A6D9229E8222CD85214Llfc", - key.line: 102, + key.line: 135, key.column: 13, key.entities: [ { key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 102, + key.line: 135, key.column: 38 } ], @@ -1490,39 +2329,215 @@ }, { key.kind: source.lang.swift.decl.var.instance, - key.name: "publicProperty", - key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV14publicPropertySivp", - key.line: 104, - key.column: 16, + key.name: "publicProperty", + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV14publicPropertySivp", + key.line: 137, + key.column: 16, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV14publicPropertySivg", + key.line: 137, + key.column: 16, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.public + } + ] + }, + { + key.kind: source.lang.swift.decl.function.accessor.setter, + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV14publicPropertySivs", + key.line: 137, + key.column: 16, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.public + } + ] + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.public + } + ], + key.effective_access: source.decl.effective_access.internal + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 137, + key.column: 32 + }, + { + key.kind: source.lang.swift.decl.var.instance, + key.name: "internalProperty", + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV16internalPropertySivp", + key.line: 138, + key.column: 9, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV16internalPropertySivg", + key.line: 138, + key.column: 9, + key.is_implicit: 1 + }, + { + key.kind: source.lang.swift.decl.function.accessor.setter, + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV16internalPropertySivs", + key.line: 138, + key.column: 9, + key.is_implicit: 1 + } + ], + key.effective_access: source.decl.effective_access.internal + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 138, + key.column: 27 + }, + { + key.kind: source.lang.swift.decl.var.instance, + key.name: "filePrivateProperty", + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV19filePrivateProperty33_2295DDF1454D6A6D9229E8222CD85214LLSivp", + key.line: 139, + key.column: 21, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV19filePrivateProperty33_2295DDF1454D6A6D9229E8222CD85214LLSivg", + key.line: 139, + key.column: 21, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.fileprivate + } + ] + }, + { + key.kind: source.lang.swift.decl.function.accessor.setter, + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV19filePrivateProperty33_2295DDF1454D6A6D9229E8222CD85214LLSivs", + key.line: 139, + key.column: 21, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.fileprivate + } + ] + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.fileprivate + } + ], + key.effective_access: source.decl.effective_access.fileprivate + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 139, + key.column: 42 + }, + { + key.kind: source.lang.swift.decl.var.instance, + key.name: "privateProperty", + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV15privateProperty33_2295DDF1454D6A6D9229E8222CD85214LLSivp", + key.line: 140, + key.column: 17, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV15privateProperty33_2295DDF1454D6A6D9229E8222CD85214LLSivg", + key.line: 140, + key.column: 17, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.private + } + ] + }, + { + key.kind: source.lang.swift.decl.function.accessor.setter, + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV15privateProperty33_2295DDF1454D6A6D9229E8222CD85214LLSivs", + key.line: 140, + key.column: 17, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.private + } + ] + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.private + } + ], + key.effective_access: source.decl.effective_access.less_than_fileprivate + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 140, + key.column: 34 + }, + { + key.kind: source.lang.swift.decl.var.instance, + key.name: "publicPropertyWithPrivateSetter", + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV31publicPropertyWithPrivateSetterSivp", + key.line: 141, + key.column: 29, key.entities: [ { key.kind: source.lang.swift.decl.function.accessor.getter, - key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV14publicPropertySivg", - key.line: 104, - key.column: 16, + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV31publicPropertyWithPrivateSetterSivg", + key.line: 141, + key.column: 29, key.is_implicit: 1, key.attributes: [ + { + key.attribute: source.decl.attribute.setter_access.private + }, { key.attribute: source.decl.attribute.public } - ], - key.effective_access: source.decl.effective_access.internal + ] }, { key.kind: source.lang.swift.decl.function.accessor.setter, - key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV14publicPropertySivs", - key.line: 104, - key.column: 16, + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV31publicPropertyWithPrivateSetterSivs", + key.line: 141, + key.column: 29, key.is_implicit: 1, key.attributes: [ + { + key.attribute: source.decl.attribute.setter_access.private + }, { key.attribute: source.decl.attribute.public } - ], - key.effective_access: source.decl.effective_access.internal + ] } ], key.attributes: [ + { + key.attribute: source.decl.attribute.setter_access.private + }, { key.attribute: source.decl.attribute.public } @@ -1533,31 +2548,67 @@ key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 104, - key.column: 32 + key.line: 141, + key.column: 62 + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "PublicPropertyWrapper", + key.usr: "s:28index_effective_access_level21PublicPropertyWrapperV", + key.line: 143, + key.column: 6 + }, + { + key.kind: source.lang.swift.ref.function.constructor, + key.usr: "s:28index_effective_access_level21PublicPropertyWrapperV12wrappedValueACyxGx_tcfc", + key.line: 143, + key.column: 6, + key.is_implicit: 1 }, { key.kind: source.lang.swift.decl.var.instance, - key.name: "internalProperty", - key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV16internalPropertySivp", - key.line: 105, - key.column: 9, + key.name: "publicPropertyWrappedProperty", + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV021publicPropertyWrappedJ0Sivp", + key.line: 143, + key.column: 39, key.entities: [ { key.kind: source.lang.swift.decl.function.accessor.getter, - key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV16internalPropertySivg", - key.line: 105, - key.column: 9, + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV021publicPropertyWrappedJ0Sivg", + key.line: 143, + key.column: 39, key.is_implicit: 1, - key.effective_access: source.decl.effective_access.internal + key.attributes: [ + { + key.attribute: source.decl.attribute.public + }, + { + key.attribute: source.decl.attribute._custom + } + ] }, { key.kind: source.lang.swift.decl.function.accessor.setter, - key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV16internalPropertySivs", - key.line: 105, - key.column: 9, + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV021publicPropertyWrappedJ0Sivs", + key.line: 143, + key.column: 39, key.is_implicit: 1, - key.effective_access: source.decl.effective_access.internal + key.attributes: [ + { + key.attribute: source.decl.attribute.public + }, + { + key.attribute: source.decl.attribute._custom + } + ] + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.public + }, + { + key.attribute: source.decl.attribute._custom } ], key.effective_access: source.decl.effective_access.internal @@ -1566,189 +2617,233 @@ key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 105, - key.column: 27 + key.line: 143, + key.column: 70 + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "PublicPropertyWrapper", + key.usr: "s:28index_effective_access_level21PublicPropertyWrapperV", + key.line: 144, + key.column: 6 + }, + { + key.kind: source.lang.swift.ref.function.constructor, + key.usr: "s:28index_effective_access_level21PublicPropertyWrapperV12wrappedValueACyxGx_tcfc", + key.line: 144, + key.column: 6, + key.is_implicit: 1 }, { key.kind: source.lang.swift.decl.var.instance, - key.name: "filePrivateProperty", - key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV19filePrivateProperty33_2295DDF1454D6A6D9229E8222CD85214LLSivp", - key.line: 106, - key.column: 21, + key.name: "internalPropertyWrappedProperty", + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV023internalPropertyWrappedJ0Sivp", + key.line: 144, + key.column: 32, key.entities: [ { key.kind: source.lang.swift.decl.function.accessor.getter, - key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV19filePrivateProperty33_2295DDF1454D6A6D9229E8222CD85214LLSivg", - key.line: 106, - key.column: 21, + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV023internalPropertyWrappedJ0Sivg", + key.line: 144, + key.column: 32, key.is_implicit: 1, key.attributes: [ { - key.attribute: source.decl.attribute.fileprivate + key.attribute: source.decl.attribute._custom } - ], - key.effective_access: source.decl.effective_access.fileprivate + ] }, { key.kind: source.lang.swift.decl.function.accessor.setter, - key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV19filePrivateProperty33_2295DDF1454D6A6D9229E8222CD85214LLSivs", - key.line: 106, - key.column: 21, + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV023internalPropertyWrappedJ0Sivs", + key.line: 144, + key.column: 32, key.is_implicit: 1, key.attributes: [ { - key.attribute: source.decl.attribute.fileprivate + key.attribute: source.decl.attribute._custom } - ], - key.effective_access: source.decl.effective_access.fileprivate + ] } ], key.attributes: [ { - key.attribute: source.decl.attribute.fileprivate + key.attribute: source.decl.attribute._custom } ], - key.effective_access: source.decl.effective_access.fileprivate + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 106, - key.column: 42 + key.line: 144, + key.column: 65 + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "PublicPropertyWrapper", + key.usr: "s:28index_effective_access_level21PublicPropertyWrapperV", + key.line: 145, + key.column: 6 + }, + { + key.kind: source.lang.swift.ref.function.constructor, + key.usr: "s:28index_effective_access_level21PublicPropertyWrapperV12wrappedValueACyxGx_tcfc", + key.line: 145, + key.column: 6, + key.is_implicit: 1 }, { key.kind: source.lang.swift.decl.var.instance, - key.name: "privateProperty", - key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV15privateProperty33_2295DDF1454D6A6D9229E8222CD85214LLSivp", - key.line: 107, - key.column: 17, + key.name: "filePrivatePropertyWrappedProperty", + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV026filePrivatePropertyWrappedK033_2295DDF1454D6A6D9229E8222CD85214LLSivp", + key.line: 145, + key.column: 44, key.entities: [ { key.kind: source.lang.swift.decl.function.accessor.getter, - key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV15privateProperty33_2295DDF1454D6A6D9229E8222CD85214LLSivg", - key.line: 107, - key.column: 17, + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV026filePrivatePropertyWrappedK033_2295DDF1454D6A6D9229E8222CD85214LLSivg", + key.line: 145, + key.column: 44, key.is_implicit: 1, key.attributes: [ { - key.attribute: source.decl.attribute.private + key.attribute: source.decl.attribute.fileprivate + }, + { + key.attribute: source.decl.attribute._custom } - ], - key.effective_access: source.decl.effective_access.less_than_fileprivate + ] }, { key.kind: source.lang.swift.decl.function.accessor.setter, - key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV15privateProperty33_2295DDF1454D6A6D9229E8222CD85214LLSivs", - key.line: 107, - key.column: 17, + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV026filePrivatePropertyWrappedK033_2295DDF1454D6A6D9229E8222CD85214LLSivs", + key.line: 145, + key.column: 44, key.is_implicit: 1, key.attributes: [ { - key.attribute: source.decl.attribute.private + key.attribute: source.decl.attribute.fileprivate + }, + { + key.attribute: source.decl.attribute._custom } - ], - key.effective_access: source.decl.effective_access.less_than_fileprivate + ] } ], key.attributes: [ { - key.attribute: source.decl.attribute.private + key.attribute: source.decl.attribute.fileprivate + }, + { + key.attribute: source.decl.attribute._custom } ], - key.effective_access: source.decl.effective_access.less_than_fileprivate + key.effective_access: source.decl.effective_access.fileprivate }, { key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 107, - key.column: 34 + key.line: 145, + key.column: 80 + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "PublicPropertyWrapper", + key.usr: "s:28index_effective_access_level21PublicPropertyWrapperV", + key.line: 146, + key.column: 6 + }, + { + key.kind: source.lang.swift.ref.function.constructor, + key.usr: "s:28index_effective_access_level21PublicPropertyWrapperV12wrappedValueACyxGx_tcfc", + key.line: 146, + key.column: 6, + key.is_implicit: 1 }, { key.kind: source.lang.swift.decl.var.instance, - key.name: "publicPropertyWithPrivateSetter", - key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV31publicPropertyWithPrivateSetterSivp", - key.line: 108, - key.column: 29, + key.name: "privatePropertyWrappedProperty", + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV022privatePropertyWrappedJ033_2295DDF1454D6A6D9229E8222CD85214LLSivp", + key.line: 146, + key.column: 40, key.entities: [ { key.kind: source.lang.swift.decl.function.accessor.getter, - key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV31publicPropertyWithPrivateSetterSivg", - key.line: 108, - key.column: 29, + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV022privatePropertyWrappedJ033_2295DDF1454D6A6D9229E8222CD85214LLSivg", + key.line: 146, + key.column: 40, key.is_implicit: 1, key.attributes: [ { - key.attribute: source.decl.attribute.setter_access.private + key.attribute: source.decl.attribute.private }, { - key.attribute: source.decl.attribute.public + key.attribute: source.decl.attribute._custom } - ], - key.effective_access: source.decl.effective_access.internal + ] }, { key.kind: source.lang.swift.decl.function.accessor.setter, - key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV31publicPropertyWithPrivateSetterSivs", - key.line: 108, - key.column: 29, + key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV022privatePropertyWrappedJ033_2295DDF1454D6A6D9229E8222CD85214LLSivs", + key.line: 146, + key.column: 40, key.is_implicit: 1, key.attributes: [ { - key.attribute: source.decl.attribute.setter_access.private + key.attribute: source.decl.attribute.private }, { - key.attribute: source.decl.attribute.public + key.attribute: source.decl.attribute._custom } - ], - key.effective_access: source.decl.effective_access.internal + ] } ], key.attributes: [ { - key.attribute: source.decl.attribute.setter_access.private + key.attribute: source.decl.attribute.private }, { - key.attribute: source.decl.attribute.public + key.attribute: source.decl.attribute._custom } ], - key.effective_access: source.decl.effective_access.internal + key.effective_access: source.decl.effective_access.less_than_fileprivate }, { key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 108, - key.column: 62 + key.line: 146, + key.column: 72 }, { key.kind: source.lang.swift.decl.function.subscript, key.name: "subscript(_:)", key.usr: "s:28index_effective_access_level25PartialScopeReducerStructVyS2icip", - key.line: 110, + key.line: 148, key.column: 12, key.entities: [ { key.kind: source.lang.swift.decl.function.accessor.getter, key.name: "getter:subscript(_:)", key.usr: "s:28index_effective_access_level25PartialScopeReducerStructVyS2icig", - key.line: 110, - key.column: 51, - key.effective_access: source.decl.effective_access.internal + key.line: 148, + key.column: 51 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 110, + key.line: 148, key.column: 39 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 110, + key.line: 148, key.column: 47 } ], @@ -1763,29 +2858,28 @@ key.kind: source.lang.swift.decl.function.subscript, key.name: "subscript(_:)", key.usr: "s:28index_effective_access_level25PartialScopeReducerStructVXeip", - key.line: 111, + key.line: 149, key.column: 5, key.entities: [ { key.kind: source.lang.swift.decl.function.accessor.getter, key.name: "getter:subscript(_:)", key.usr: "s:28index_effective_access_level25PartialScopeReducerStructVXeig", - key.line: 111, - key.column: 46, - key.effective_access: source.decl.effective_access.internal + key.line: 149, + key.column: 46 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 111, + key.line: 149, key.column: 34 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 111, + key.line: 149, key.column: 42 } ], @@ -1795,29 +2889,28 @@ key.kind: source.lang.swift.decl.function.subscript, key.name: "subscript(_:)", key.usr: "s:28index_effective_access_level25PartialScopeReducerStructVXe33_2295DDF1454D6A6D9229E8222CD85214Llip", - key.line: 112, + key.line: 150, key.column: 17, key.entities: [ { key.kind: source.lang.swift.decl.function.accessor.getter, key.name: "getter:subscript(_:)", key.usr: "s:28index_effective_access_level25PartialScopeReducerStructVXe33_2295DDF1454D6A6D9229E8222CD85214Llig", - key.line: 112, - key.column: 61, - key.effective_access: source.decl.effective_access.fileprivate + key.line: 150, + key.column: 61 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 112, + key.line: 150, key.column: 49 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 112, + key.line: 150, key.column: 57 } ], @@ -1832,29 +2925,28 @@ key.kind: source.lang.swift.decl.function.subscript, key.name: "subscript(_:)", key.usr: "s:28index_effective_access_level25PartialScopeReducerStructVXe33_2295DDF1454D6A6D9229E8222CD85214Llip", - key.line: 113, + key.line: 151, key.column: 13, key.entities: [ { key.kind: source.lang.swift.decl.function.accessor.getter, key.name: "getter:subscript(_:)", key.usr: "s:28index_effective_access_level25PartialScopeReducerStructVXe33_2295DDF1454D6A6D9229E8222CD85214Llig", - key.line: 113, - key.column: 53, - key.effective_access: source.decl.effective_access.less_than_fileprivate + key.line: 151, + key.column: 53 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 113, + key.line: 151, key.column: 41 }, { key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 113, + key.line: 151, key.column: 49 } ], @@ -1869,7 +2961,7 @@ key.kind: source.lang.swift.decl.function.method.instance, key.name: "publicMethod()", key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV12publicMethodyyF", - key.line: 115, + key.line: 153, key.column: 17, key.attributes: [ { @@ -1882,7 +2974,7 @@ key.kind: source.lang.swift.decl.function.method.instance, key.name: "internalMethod()", key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV14internalMethodyyF", - key.line: 116, + key.line: 154, key.column: 10, key.effective_access: source.decl.effective_access.internal }, @@ -1890,7 +2982,7 @@ key.kind: source.lang.swift.decl.function.method.instance, key.name: "filePrivateMethod()", key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV17filePrivateMethod33_2295DDF1454D6A6D9229E8222CD85214LLyyF", - key.line: 117, + key.line: 155, key.column: 22, key.attributes: [ { @@ -1903,7 +2995,7 @@ key.kind: source.lang.swift.decl.function.method.instance, key.name: "privateMethod()", key.usr: "s:28index_effective_access_level25PartialScopeReducerStructV13privateMethod33_2295DDF1454D6A6D9229E8222CD85214LLyyF", - key.line: 118, + key.line: 156, key.column: 18, key.attributes: [ { @@ -1919,21 +3011,21 @@ key.kind: source.lang.swift.decl.extension.enum, key.name: "PrivateEnum", key.usr: "s:e:s:28index_effective_access_level11PrivateEnum33_2295DDF1454D6A6D9229E8222CD85214LLO017privateMethodFromE9ExtensionyyF", - key.line: 121, + key.line: 159, key.column: 19, key.entities: [ { key.kind: source.lang.swift.ref.enum, key.name: "PrivateEnum", key.usr: "s:28index_effective_access_level11PrivateEnum33_2295DDF1454D6A6D9229E8222CD85214LLO", - key.line: 121, + key.line: 159, key.column: 19 }, { key.kind: source.lang.swift.decl.function.method.instance, key.name: "privateMethodFromPrivateExtension()", key.usr: "s:28index_effective_access_level11PrivateEnum33_2295DDF1454D6A6D9229E8222CD85214LLO017privateMethodFromE9ExtensionyyF", - key.line: 122, + key.line: 160, key.column: 18, key.attributes: [ { @@ -1953,33 +3045,31 @@ key.kind: source.lang.swift.decl.protocol, key.name: "PublicProtocol", key.usr: "s:28index_effective_access_level14PublicProtocolP", - key.line: 125, + key.line: 163, key.column: 17, key.entities: [ { key.kind: source.lang.swift.decl.var.instance, key.name: "member", key.usr: "s:28index_effective_access_level14PublicProtocolP6memberSivp", - key.line: 126, + key.line: 164, key.column: 9, key.entities: [ { key.kind: source.lang.swift.decl.function.accessor.getter, key.name: "getter:member", key.usr: "s:28index_effective_access_level14PublicProtocolP6memberSivg", - key.line: 126, + key.line: 164, key.column: 23, - key.is_dynamic: 1, - key.effective_access: source.decl.effective_access.public + key.is_dynamic: 1 }, { key.kind: source.lang.swift.decl.function.accessor.setter, key.name: "setter:member", key.usr: "s:28index_effective_access_level14PublicProtocolP6memberSivs", - key.line: 126, + key.line: 164, key.column: 27, - key.is_dynamic: 1, - key.effective_access: source.decl.effective_access.public + key.is_dynamic: 1 } ], key.effective_access: source.decl.effective_access.public @@ -1988,14 +3078,14 @@ key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 126, + key.line: 164, key.column: 17 }, { key.kind: source.lang.swift.decl.function.method.instance, key.name: "method()", key.usr: "s:28index_effective_access_level14PublicProtocolP6methodyyF", - key.line: 127, + key.line: 165, key.column: 10, key.is_dynamic: 1, key.effective_access: source.decl.effective_access.public @@ -2012,33 +3102,31 @@ key.kind: source.lang.swift.decl.protocol, key.name: "InternalProtocol", key.usr: "s:28index_effective_access_level16InternalProtocolP", - key.line: 130, + key.line: 168, key.column: 10, key.entities: [ { key.kind: source.lang.swift.decl.var.instance, key.name: "member", key.usr: "s:28index_effective_access_level16InternalProtocolP6memberSivp", - key.line: 131, + key.line: 169, key.column: 9, key.entities: [ { key.kind: source.lang.swift.decl.function.accessor.getter, key.name: "getter:member", key.usr: "s:28index_effective_access_level16InternalProtocolP6memberSivg", - key.line: 131, + key.line: 169, key.column: 23, - key.is_dynamic: 1, - key.effective_access: source.decl.effective_access.internal + key.is_dynamic: 1 }, { key.kind: source.lang.swift.decl.function.accessor.setter, key.name: "setter:member", key.usr: "s:28index_effective_access_level16InternalProtocolP6memberSivs", - key.line: 131, + key.line: 169, key.column: 27, - key.is_dynamic: 1, - key.effective_access: source.decl.effective_access.internal + key.is_dynamic: 1 } ], key.effective_access: source.decl.effective_access.internal @@ -2047,14 +3135,14 @@ key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 131, + key.line: 169, key.column: 17 }, { key.kind: source.lang.swift.decl.function.method.instance, key.name: "method()", key.usr: "s:28index_effective_access_level16InternalProtocolP6methodyyF", - key.line: 132, + key.line: 170, key.column: 10, key.is_dynamic: 1, key.effective_access: source.decl.effective_access.internal @@ -2066,33 +3154,31 @@ key.kind: source.lang.swift.decl.protocol, key.name: "FilePrivateProtocol", key.usr: "s:28index_effective_access_level19FilePrivateProtocol33_2295DDF1454D6A6D9229E8222CD85214LLP", - key.line: 135, + key.line: 173, key.column: 22, key.entities: [ { key.kind: source.lang.swift.decl.var.instance, key.name: "member", key.usr: "s:28index_effective_access_level19FilePrivateProtocol33_2295DDF1454D6A6D9229E8222CD85214LLP6memberSivp", - key.line: 136, + key.line: 174, key.column: 9, key.entities: [ { key.kind: source.lang.swift.decl.function.accessor.getter, key.name: "getter:member", key.usr: "s:28index_effective_access_level19FilePrivateProtocol33_2295DDF1454D6A6D9229E8222CD85214LLP6memberSivg", - key.line: 136, + key.line: 174, key.column: 23, - key.is_dynamic: 1, - key.effective_access: source.decl.effective_access.fileprivate + key.is_dynamic: 1 }, { key.kind: source.lang.swift.decl.function.accessor.setter, key.name: "setter:member", key.usr: "s:28index_effective_access_level19FilePrivateProtocol33_2295DDF1454D6A6D9229E8222CD85214LLP6memberSivs", - key.line: 136, + key.line: 174, key.column: 27, - key.is_dynamic: 1, - key.effective_access: source.decl.effective_access.fileprivate + key.is_dynamic: 1 } ], key.effective_access: source.decl.effective_access.fileprivate @@ -2101,14 +3187,14 @@ key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 136, + key.line: 174, key.column: 17 }, { key.kind: source.lang.swift.decl.function.method.instance, key.name: "method()", key.usr: "s:28index_effective_access_level19FilePrivateProtocol33_2295DDF1454D6A6D9229E8222CD85214LLP6methodyyF", - key.line: 137, + key.line: 175, key.column: 10, key.is_dynamic: 1, key.effective_access: source.decl.effective_access.fileprivate @@ -2125,33 +3211,31 @@ key.kind: source.lang.swift.decl.protocol, key.name: "PrivateProtocol", key.usr: "s:28index_effective_access_level15PrivateProtocol33_2295DDF1454D6A6D9229E8222CD85214LLP", - key.line: 140, + key.line: 178, key.column: 18, key.entities: [ { key.kind: source.lang.swift.decl.var.instance, key.name: "member", key.usr: "s:28index_effective_access_level15PrivateProtocol33_2295DDF1454D6A6D9229E8222CD85214LLP6memberSivp", - key.line: 141, + key.line: 179, key.column: 9, key.entities: [ { key.kind: source.lang.swift.decl.function.accessor.getter, key.name: "getter:member", key.usr: "s:28index_effective_access_level15PrivateProtocol33_2295DDF1454D6A6D9229E8222CD85214LLP6memberSivg", - key.line: 141, + key.line: 179, key.column: 23, - key.is_dynamic: 1, - key.effective_access: source.decl.effective_access.fileprivate + key.is_dynamic: 1 }, { key.kind: source.lang.swift.decl.function.accessor.setter, key.name: "setter:member", key.usr: "s:28index_effective_access_level15PrivateProtocol33_2295DDF1454D6A6D9229E8222CD85214LLP6memberSivs", - key.line: 141, + key.line: 179, key.column: 27, - key.is_dynamic: 1, - key.effective_access: source.decl.effective_access.fileprivate + key.is_dynamic: 1 } ], key.effective_access: source.decl.effective_access.fileprivate @@ -2160,14 +3244,14 @@ key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 141, + key.line: 179, key.column: 17 }, { key.kind: source.lang.swift.decl.function.method.instance, key.name: "method()", key.usr: "s:28index_effective_access_level15PrivateProtocol33_2295DDF1454D6A6D9229E8222CD85214LLP6methodyyF", - key.line: 142, + key.line: 180, key.column: 10, key.is_dynamic: 1, key.effective_access: source.decl.effective_access.fileprivate @@ -2184,14 +3268,14 @@ key.kind: source.lang.swift.decl.struct, key.name: "FilePrivateImplementationOfPublicProtocol", key.usr: "s:28index_effective_access_level41FilePrivateImplementationOfPublicProtocol33_2295DDF1454D6A6D9229E8222CD85214LLV", - key.line: 145, + key.line: 183, key.column: 20, key.related: [ { key.kind: source.lang.swift.ref.protocol, key.name: "PublicProtocol", key.usr: "s:28index_effective_access_level14PublicProtocolP", - key.line: 145, + key.line: 183, key.column: 63 } ], @@ -2200,14 +3284,14 @@ key.kind: source.lang.swift.ref.protocol, key.name: "PublicProtocol", key.usr: "s:28index_effective_access_level14PublicProtocolP", - key.line: 145, + key.line: 183, key.column: 63 }, { key.kind: source.lang.swift.decl.var.instance, key.name: "member", key.usr: "s:28index_effective_access_level41FilePrivateImplementationOfPublicProtocol33_2295DDF1454D6A6D9229E8222CD85214LLV6memberSivp", - key.line: 146, + key.line: 184, key.column: 21, key.related: [ { @@ -2220,28 +3304,26 @@ { key.kind: source.lang.swift.decl.function.accessor.getter, key.usr: "s:28index_effective_access_level41FilePrivateImplementationOfPublicProtocol33_2295DDF1454D6A6D9229E8222CD85214LLV6memberSivg", - key.line: 146, + key.line: 184, key.column: 21, key.is_implicit: 1, key.attributes: [ { key.attribute: source.decl.attribute.fileprivate } - ], - key.effective_access: source.decl.effective_access.fileprivate + ] }, { key.kind: source.lang.swift.decl.function.accessor.setter, key.usr: "s:28index_effective_access_level41FilePrivateImplementationOfPublicProtocol33_2295DDF1454D6A6D9229E8222CD85214LLV6memberSivs", - key.line: 146, + key.line: 184, key.column: 21, key.is_implicit: 1, key.attributes: [ { key.attribute: source.decl.attribute.fileprivate } - ], - key.effective_access: source.decl.effective_access.fileprivate + ] } ], key.attributes: [ @@ -2255,14 +3337,14 @@ key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 146, + key.line: 184, key.column: 29 }, { key.kind: source.lang.swift.decl.function.method.instance, key.name: "method()", key.usr: "s:28index_effective_access_level41FilePrivateImplementationOfPublicProtocol33_2295DDF1454D6A6D9229E8222CD85214LLV6methodyyF", - key.line: 147, + key.line: 185, key.column: 22, key.related: [ { @@ -2281,7 +3363,7 @@ { key.kind: source.lang.swift.decl.function.constructor, key.usr: "s:28index_effective_access_level41FilePrivateImplementationOfPublicProtocol33_2295DDF1454D6A6D9229E8222CD85214LLV6memberADSi_tcfc", - key.line: 145, + key.line: 183, key.column: 20, key.is_implicit: 1, key.effective_access: source.decl.effective_access.fileprivate @@ -2289,7 +3371,7 @@ { key.kind: source.lang.swift.decl.function.constructor, key.usr: "s:28index_effective_access_level41FilePrivateImplementationOfPublicProtocol33_2295DDF1454D6A6D9229E8222CD85214LLVADycfc", - key.line: 145, + key.line: 183, key.column: 20, key.is_implicit: 1, key.effective_access: source.decl.effective_access.fileprivate @@ -2306,24 +3388,23 @@ key.kind: source.lang.swift.decl.class, key.name: "OpenClass", key.usr: "s:28index_effective_access_level9OpenClassC", - key.line: 150, + key.line: 188, key.column: 12, key.entities: [ { key.kind: source.lang.swift.decl.var.instance, key.name: "openProperty", key.usr: "s:28index_effective_access_level9OpenClassC12openPropertySivp", - key.line: 151, + key.line: 189, key.column: 14, key.entities: [ { key.kind: source.lang.swift.decl.function.accessor.getter, key.name: "getter:openProperty", key.usr: "s:28index_effective_access_level9OpenClassC12openPropertySivg", - key.line: 151, + key.line: 189, key.column: 32, - key.is_dynamic: 1, - key.effective_access: source.decl.effective_access.public + key.is_dynamic: 1 } ], key.attributes: [ @@ -2337,24 +3418,23 @@ key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 151, + key.line: 189, key.column: 28 }, { key.kind: source.lang.swift.decl.var.instance, key.name: "publicProperty", key.usr: "s:28index_effective_access_level9OpenClassC14publicPropertySivp", - key.line: 152, + key.line: 190, key.column: 16, key.entities: [ { key.kind: source.lang.swift.decl.function.accessor.getter, key.name: "getter:publicProperty", key.usr: "s:28index_effective_access_level9OpenClassC14publicPropertySivg", - key.line: 152, + key.line: 190, key.column: 36, - key.is_dynamic: 1, - key.effective_access: source.decl.effective_access.public + key.is_dynamic: 1 } ], key.attributes: [ @@ -2368,24 +3448,23 @@ key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 152, + key.line: 190, key.column: 32 }, { key.kind: source.lang.swift.decl.var.instance, key.name: "internalProperty", key.usr: "s:28index_effective_access_level9OpenClassC16internalPropertySivp", - key.line: 153, + key.line: 191, key.column: 9, key.entities: [ { key.kind: source.lang.swift.decl.function.accessor.getter, key.name: "getter:internalProperty", key.usr: "s:28index_effective_access_level9OpenClassC16internalPropertySivg", - key.line: 153, + key.line: 191, key.column: 31, - key.is_dynamic: 1, - key.effective_access: source.decl.effective_access.internal + key.is_dynamic: 1 } ], key.effective_access: source.decl.effective_access.internal @@ -2394,14 +3473,14 @@ key.kind: source.lang.swift.ref.struct, key.name: "Int", key.usr: "s:Si", - key.line: 153, + key.line: 191, key.column: 27 }, { key.kind: source.lang.swift.decl.function.method.instance, key.name: "openMethod()", key.usr: "s:28index_effective_access_level9OpenClassC10openMethodyyF", - key.line: 155, + key.line: 193, key.column: 15, key.is_dynamic: 1, key.attributes: [ @@ -2415,7 +3494,7 @@ key.kind: source.lang.swift.decl.function.method.instance, key.name: "publicMethod()", key.usr: "s:28index_effective_access_level9OpenClassC12publicMethodyyF", - key.line: 156, + key.line: 194, key.column: 17, key.is_dynamic: 1, key.attributes: [ @@ -2429,7 +3508,7 @@ key.kind: source.lang.swift.decl.function.method.instance, key.name: "internalMethod()", key.usr: "s:28index_effective_access_level9OpenClassC14internalMethodyyF", - key.line: 157, + key.line: 195, key.column: 10, key.is_dynamic: 1, key.effective_access: source.decl.effective_access.internal @@ -2437,7 +3516,7 @@ { key.kind: source.lang.swift.decl.function.constructor, key.usr: "s:28index_effective_access_level9OpenClassCACycfc", - key.line: 150, + key.line: 188, key.column: 12, key.is_implicit: 1, key.effective_access: source.decl.effective_access.internal @@ -2454,38 +3533,36 @@ key.kind: source.lang.swift.ref.module, key.name: "Module", key.usr: "c:@M@Module", - key.line: 160, + key.line: 198, key.column: 8 }, { key.kind: source.lang.swift.decl.struct, key.name: "InternalStruct", key.usr: "s:28index_effective_access_level14InternalStructV", - key.line: 162, + key.line: 200, key.column: 8, key.entities: [ { key.kind: source.lang.swift.decl.var.instance, key.name: "propertyReferencingPublicClassFromModule", key.usr: "s:28index_effective_access_level14InternalStructV40propertyReferencingPublicClassFromModule0L00lJ0Cvp", - key.line: 163, + key.line: 201, key.column: 9, key.entities: [ { key.kind: source.lang.swift.decl.function.accessor.getter, key.usr: "s:28index_effective_access_level14InternalStructV40propertyReferencingPublicClassFromModule0L00lJ0Cvg", - key.line: 163, + key.line: 201, key.column: 9, - key.is_implicit: 1, - key.effective_access: source.decl.effective_access.internal + key.is_implicit: 1 }, { key.kind: source.lang.swift.decl.function.accessor.setter, key.usr: "s:28index_effective_access_level14InternalStructV40propertyReferencingPublicClassFromModule0L00lJ0Cvs", - key.line: 163, + key.line: 201, key.column: 9, - key.is_implicit: 1, - key.effective_access: source.decl.effective_access.internal + key.is_implicit: 1 } ], key.effective_access: source.decl.effective_access.internal @@ -2494,38 +3571,36 @@ key.kind: source.lang.swift.ref.module, key.name: "Module", key.usr: "c:@M@Module", - key.line: 163, + key.line: 201, key.column: 51 }, { key.kind: source.lang.swift.ref.class, key.name: "ModuleClass", key.usr: "s:6Module0A5ClassC", - key.line: 163, + key.line: 201, key.column: 58 }, { key.kind: source.lang.swift.decl.var.instance, key.name: "propertyReferencingPublicClassFromExportedModule", key.usr: "s:28index_effective_access_level14InternalStructV48propertyReferencingPublicClassFromExportedModule0L00lJ0Cvp", - key.line: 164, + key.line: 202, key.column: 9, key.entities: [ { key.kind: source.lang.swift.decl.function.accessor.getter, key.usr: "s:28index_effective_access_level14InternalStructV48propertyReferencingPublicClassFromExportedModule0L00lJ0Cvg", - key.line: 164, + key.line: 202, key.column: 9, - key.is_implicit: 1, - key.effective_access: source.decl.effective_access.internal + key.is_implicit: 1 }, { key.kind: source.lang.swift.decl.function.accessor.setter, key.usr: "s:28index_effective_access_level14InternalStructV48propertyReferencingPublicClassFromExportedModule0L00lJ0Cvs", - key.line: 164, + key.line: 202, key.column: 9, - key.is_implicit: 1, - key.effective_access: source.decl.effective_access.internal + key.is_implicit: 1 } ], key.effective_access: source.decl.effective_access.internal @@ -2534,20 +3609,20 @@ key.kind: source.lang.swift.ref.module, key.name: "Exported", key.usr: "c:@M@Exported", - key.line: 164, + key.line: 202, key.column: 59 }, { key.kind: source.lang.swift.ref.class, key.name: "ExportedClass", key.usr: "s:8Exported0A5ClassC", - key.line: 164, + key.line: 202, key.column: 68 }, { key.kind: source.lang.swift.decl.function.constructor, key.usr: "s:28index_effective_access_level14InternalStructV40propertyReferencingPublicClassFromModule0ghijk8ExportedL0AC0L00lJ0C_0M00mJ0Ctcfc", - key.line: 162, + key.line: 200, key.column: 8, key.is_implicit: 1, key.effective_access: source.decl.effective_access.internal diff --git a/test/SourceKit/Indexing/index_enum_case.swift.response b/test/SourceKit/Indexing/index_enum_case.swift.response index 0586e13577df4..a5a53d1769c51 100644 --- a/test/SourceKit/Indexing/index_enum_case.swift.response +++ b/test/SourceKit/Indexing/index_enum_case.swift.response @@ -83,8 +83,7 @@ key.line: 14, key.column: 15 } - ], - key.effective_access: source.decl.effective_access.internal + ] } ], key.effective_access: source.decl.effective_access.internal @@ -116,16 +115,14 @@ key.usr: "s:15index_enum_case1eAA1EOvg", key.line: 21, key.column: 5, - key.is_implicit: 1, - key.effective_access: source.decl.effective_access.internal + key.is_implicit: 1 }, { key.kind: source.lang.swift.decl.function.accessor.setter, key.usr: "s:15index_enum_case1eAA1EOvs", key.line: 21, key.column: 5, - key.is_implicit: 1, - key.effective_access: source.decl.effective_access.internal + key.is_implicit: 1 } ], key.effective_access: source.decl.effective_access.internal diff --git a/test/SourceKit/Indexing/index_forbid_typecheck.swift.response b/test/SourceKit/Indexing/index_forbid_typecheck.swift.response index b2670172e6ac6..935c7a75acc93 100644 --- a/test/SourceKit/Indexing/index_forbid_typecheck.swift.response +++ b/test/SourceKit/Indexing/index_forbid_typecheck.swift.response @@ -20,16 +20,14 @@ key.usr: "s:16forbid_typecheck10globalPrimSivg", key.line: 1, key.column: 5, - key.is_implicit: 1, - key.effective_access: source.decl.effective_access.internal + key.is_implicit: 1 }, { key.kind: source.lang.swift.decl.function.accessor.setter, key.usr: "s:16forbid_typecheck10globalPrimSivs", key.line: 1, key.column: 5, - key.is_implicit: 1, - key.effective_access: source.decl.effective_access.internal + key.is_implicit: 1 } ], key.effective_access: source.decl.effective_access.internal diff --git a/test/SourceKit/Indexing/index_objcMembers.swift.response b/test/SourceKit/Indexing/index_objcMembers.swift.response index 100c6adc5a1e9..ce2578223cde7 100644 --- a/test/SourceKit/Indexing/index_objcMembers.swift.response +++ b/test/SourceKit/Indexing/index_objcMembers.swift.response @@ -28,8 +28,7 @@ key.line: 6, key.column: 9, key.is_dynamic: 1, - key.is_implicit: 1, - key.effective_access: source.decl.effective_access.internal + key.is_implicit: 1 }, { key.kind: source.lang.swift.decl.function.accessor.setter, @@ -37,8 +36,7 @@ key.line: 6, key.column: 9, key.is_dynamic: 1, - key.is_implicit: 1, - key.effective_access: source.decl.effective_access.internal + key.is_implicit: 1 } ], key.effective_access: source.decl.effective_access.internal diff --git a/tools/SourceKit/lib/SwiftLang/SwiftIndexing.cpp b/tools/SourceKit/lib/SwiftLang/SwiftIndexing.cpp index 9f3c4c54127d6..beb844add024a 100644 --- a/tools/SourceKit/lib/SwiftLang/SwiftIndexing.cpp +++ b/tools/SourceKit/lib/SwiftLang/SwiftIndexing.cpp @@ -135,7 +135,7 @@ class SKIndexDataConsumer : public IndexDataConsumer { uidAttrs = getDeclAttributeUIDs(symbol.decl); info.Attrs = uidAttrs; if (auto *VD = dyn_cast(symbol.decl)) { - if (symbol.symInfo.Kind != SymbolKind::Extension) { + if (shouldOutputEffectiveAccessOfValueSymbol(symbol.symInfo)) { AccessScope accessScope = VD->getFormalAccessScope(); UIdent AttrUID = SwiftLangSupport::getUIDForFormalAccessScope(accessScope); info.EffectiveAccess = AttrUID; @@ -145,6 +145,29 @@ class SKIndexDataConsumer : public IndexDataConsumer { return func(info); } + bool shouldOutputEffectiveAccessOfValueSymbol(SymbolInfo Info) { + SymbolKind Kind = Info.Kind; + SymbolSubKind SubKind = Info.SubKind; + switch (Kind) { + case SymbolKind::Extension: + return false; + default: + break; + } + switch (SubKind) { + case SymbolSubKind::AccessorGetter: + case SymbolSubKind::AccessorSetter: + case SymbolSubKind::SwiftAccessorWillSet: + case SymbolSubKind::SwiftAccessorDidSet: + case SymbolSubKind::SwiftAccessorAddressor: + case SymbolSubKind::SwiftAccessorMutableAddressor: + return false; + default: + break; + } + return true; + } + template bool withEntityInfo(const IndexRelation &relation, F func) { EntityInfo info; From 51c00246745c1ffc1f63451c2d947271684ca623 Mon Sep 17 00:00:00 2001 From: Bruno Rocha Date: Tue, 26 May 2020 21:20:11 +0200 Subject: [PATCH 04/50] Whitelist instead of blacklist --- .../index_effective_access_level.swift | 12 ++ ...ndex_effective_access_level.swift.response | 156 +++++++++++++++++- .../SourceKit/lib/SwiftLang/SwiftIndexing.cpp | 28 +++- 3 files changed, 181 insertions(+), 15 deletions(-) diff --git a/test/SourceKit/Indexing/index_effective_access_level.swift b/test/SourceKit/Indexing/index_effective_access_level.swift index e3485b668925d..c309847b27332 100644 --- a/test/SourceKit/Indexing/index_effective_access_level.swift +++ b/test/SourceKit/Indexing/index_effective_access_level.swift @@ -201,3 +201,15 @@ struct InternalStruct { let propertyReferencingPublicClassFromModule: Module.ModuleClass let propertyReferencingPublicClassFromExportedModule: Exported.ExportedClass } + +public typealias Alias = Int + +public var globalVariable: Int = 0 + +protocol ProtocolWithAssociatedType { + associatedtype T +} + +struct ProtocolWithAssociatedTypeImpl: ProtocolWithAssociatedType { + typealias T = Int +} diff --git a/test/SourceKit/Indexing/index_effective_access_level.swift.response b/test/SourceKit/Indexing/index_effective_access_level.swift.response index 668baf133eb0c..3f2dd1024469d 100644 --- a/test/SourceKit/Indexing/index_effective_access_level.swift.response +++ b/test/SourceKit/Indexing/index_effective_access_level.swift.response @@ -366,8 +366,7 @@ key.name: "T", key.usr: "s:28index_effective_access_level21PublicPropertyWrapperV1Txmfp", key.line: 53, - key.column: 37, - key.effective_access: source.decl.effective_access.internal + key.column: 37 }, { key.kind: source.lang.swift.decl.var.instance, @@ -477,8 +476,7 @@ key.name: "T", key.usr: "s:28index_effective_access_level23InternalPropertyWrapperV1Txmfp", key.line: 61, - key.column: 32, - key.effective_access: source.decl.effective_access.internal + key.column: 32 }, { key.kind: source.lang.swift.decl.var.instance, @@ -539,8 +537,7 @@ key.name: "T", key.usr: "s:28index_effective_access_level26FilePrivatePropertyWrapper33_2295DDF1454D6A6D9229E8222CD85214LLV1Txmfp", key.line: 66, - key.column: 47, - key.effective_access: source.decl.effective_access.fileprivate + key.column: 47 }, { key.kind: source.lang.swift.decl.var.instance, @@ -619,8 +616,7 @@ key.name: "T", key.usr: "s:28index_effective_access_level22PrivatePropertyWrapper33_2295DDF1454D6A6D9229E8222CD85214LLV1Txmfp", key.line: 71, - key.column: 39, - key.effective_access: source.decl.effective_access.fileprivate + key.column: 39 }, { key.kind: source.lang.swift.decl.var.instance, @@ -3629,6 +3625,150 @@ } ], key.effective_access: source.decl.effective_access.internal + }, + { + key.kind: source.lang.swift.decl.typealias, + key.name: "Alias", + key.usr: "s:28index_effective_access_level5Aliasa", + key.line: 205, + key.column: 18, + key.entities: [ + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 205, + key.column: 26 + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.public + } + ], + key.effective_access: source.decl.effective_access.public + }, + { + key.kind: source.lang.swift.decl.var.global, + key.name: "globalVariable", + key.usr: "s:28index_effective_access_level14globalVariableSivp", + key.line: 207, + key.column: 12, + key.entities: [ + { + key.kind: source.lang.swift.decl.function.accessor.getter, + key.usr: "s:28index_effective_access_level14globalVariableSivg", + key.line: 207, + key.column: 12, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.public + } + ] + }, + { + key.kind: source.lang.swift.decl.function.accessor.setter, + key.usr: "s:28index_effective_access_level14globalVariableSivs", + key.line: 207, + key.column: 12, + key.is_implicit: 1, + key.attributes: [ + { + key.attribute: source.decl.attribute.public + } + ] + } + ], + key.attributes: [ + { + key.attribute: source.decl.attribute.public + } + ], + key.effective_access: source.decl.effective_access.public + }, + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 207, + key.column: 28 + }, + { + key.kind: source.lang.swift.decl.protocol, + key.name: "ProtocolWithAssociatedType", + key.usr: "s:28index_effective_access_level26ProtocolWithAssociatedTypeP", + key.line: 209, + key.column: 10, + key.entities: [ + { + key.kind: source.lang.swift.decl.associatedtype, + key.name: "T", + key.usr: "s:28index_effective_access_level26ProtocolWithAssociatedTypeP1TQa", + key.line: 210, + key.column: 20, + key.effective_access: source.decl.effective_access.internal + } + ], + key.effective_access: source.decl.effective_access.internal + }, + { + key.kind: source.lang.swift.decl.struct, + key.name: "ProtocolWithAssociatedTypeImpl", + key.usr: "s:28index_effective_access_level30ProtocolWithAssociatedTypeImplV", + key.line: 213, + key.column: 8, + key.related: [ + { + key.kind: source.lang.swift.ref.protocol, + key.name: "ProtocolWithAssociatedType", + key.usr: "s:28index_effective_access_level26ProtocolWithAssociatedTypeP", + key.line: 213, + key.column: 40 + } + ], + key.entities: [ + { + key.kind: source.lang.swift.ref.protocol, + key.name: "ProtocolWithAssociatedType", + key.usr: "s:28index_effective_access_level26ProtocolWithAssociatedTypeP", + key.line: 213, + key.column: 40 + }, + { + key.kind: source.lang.swift.decl.typealias, + key.name: "T", + key.usr: "s:28index_effective_access_level30ProtocolWithAssociatedTypeImplV1Ta", + key.line: 214, + key.column: 15, + key.related: [ + { + key.kind: source.lang.swift.ref.associatedtype, + key.name: "T", + key.usr: "s:28index_effective_access_level26ProtocolWithAssociatedTypeP1TQa" + } + ], + key.entities: [ + { + key.kind: source.lang.swift.ref.struct, + key.name: "Int", + key.usr: "s:Si", + key.line: 214, + key.column: 19 + } + ], + key.effective_access: source.decl.effective_access.internal + }, + { + key.kind: source.lang.swift.decl.function.constructor, + key.usr: "s:28index_effective_access_level30ProtocolWithAssociatedTypeImplVACycfc", + key.line: 213, + key.column: 8, + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.internal + } + ], + key.effective_access: source.decl.effective_access.internal } ] } diff --git a/tools/SourceKit/lib/SwiftLang/SwiftIndexing.cpp b/tools/SourceKit/lib/SwiftLang/SwiftIndexing.cpp index beb844add024a..0bfc29a0ae24c 100644 --- a/tools/SourceKit/lib/SwiftLang/SwiftIndexing.cpp +++ b/tools/SourceKit/lib/SwiftLang/SwiftIndexing.cpp @@ -148,12 +148,6 @@ class SKIndexDataConsumer : public IndexDataConsumer { bool shouldOutputEffectiveAccessOfValueSymbol(SymbolInfo Info) { SymbolKind Kind = Info.Kind; SymbolSubKind SubKind = Info.SubKind; - switch (Kind) { - case SymbolKind::Extension: - return false; - default: - break; - } switch (SubKind) { case SymbolSubKind::AccessorGetter: case SymbolSubKind::AccessorSetter: @@ -161,11 +155,31 @@ class SKIndexDataConsumer : public IndexDataConsumer { case SymbolSubKind::SwiftAccessorDidSet: case SymbolSubKind::SwiftAccessorAddressor: case SymbolSubKind::SwiftAccessorMutableAddressor: + case SymbolSubKind::SwiftGenericTypeParam: return false; default: break; } - return true; + switch (Kind) { + case SymbolKind::Enum: + case SymbolKind::Struct: + case SymbolKind::Class: + case SymbolKind::Protocol: + case SymbolKind::Constructor: + case SymbolKind::EnumConstant: + case SymbolKind::Function: + case SymbolKind::StaticMethod: + case SymbolKind::Variable: + case SymbolKind::InstanceMethod: + case SymbolKind::ClassMethod: + case SymbolKind::InstanceProperty: + case SymbolKind::ClassProperty: + case SymbolKind::StaticProperty: + case SymbolKind::TypeAlias: + return true; + default: + return false; + } } template From 6ebf0d554ecfe37d16c413fcbe407864bc971eea Mon Sep 17 00:00:00 2001 From: Bruno Rocha Date: Tue, 26 May 2020 21:29:51 +0200 Subject: [PATCH 05/50] Add a test showing local content being ignored --- .../SourceKit/Indexing/index_effective_access_level.swift | 3 +++ .../Indexing/index_effective_access_level.swift.response | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/test/SourceKit/Indexing/index_effective_access_level.swift b/test/SourceKit/Indexing/index_effective_access_level.swift index c309847b27332..6f82492e44a6e 100644 --- a/test/SourceKit/Indexing/index_effective_access_level.swift +++ b/test/SourceKit/Indexing/index_effective_access_level.swift @@ -212,4 +212,7 @@ protocol ProtocolWithAssociatedType { struct ProtocolWithAssociatedTypeImpl: ProtocolWithAssociatedType { typealias T = Int + func testLocalContent() { + let localVariableShouldntBeIndexed = 0 + } } diff --git a/test/SourceKit/Indexing/index_effective_access_level.swift.response b/test/SourceKit/Indexing/index_effective_access_level.swift.response index 3f2dd1024469d..2096c5271cfe6 100644 --- a/test/SourceKit/Indexing/index_effective_access_level.swift.response +++ b/test/SourceKit/Indexing/index_effective_access_level.swift.response @@ -3759,6 +3759,14 @@ ], key.effective_access: source.decl.effective_access.internal }, + { + key.kind: source.lang.swift.decl.function.method.instance, + key.name: "testLocalContent()", + key.usr: "s:28index_effective_access_level30ProtocolWithAssociatedTypeImplV16testLocalContentyyF", + key.line: 215, + key.column: 10, + key.effective_access: source.decl.effective_access.internal + }, { key.kind: source.lang.swift.decl.function.constructor, key.usr: "s:28index_effective_access_level30ProtocolWithAssociatedTypeImplVACycfc", From b50813a6bc47a8d07a2e9222227d90045c39bf6c Mon Sep 17 00:00:00 2001 From: Bruno Rocha Date: Wed, 27 May 2020 09:46:37 +0200 Subject: [PATCH 06/50] Run linux only test --- .../index_is_test_candidate.swift.response | 51 ++++++++++++------- 1 file changed, 34 insertions(+), 17 deletions(-) diff --git a/test/SourceKit/Indexing/index_is_test_candidate.swift.response b/test/SourceKit/Indexing/index_is_test_candidate.swift.response index 56b0ab8bf1ca4..5be0064ed2945 100644 --- a/test/SourceKit/Indexing/index_is_test_candidate.swift.response +++ b/test/SourceKit/Indexing/index_is_test_candidate.swift.response @@ -13,7 +13,8 @@ key.name: "test_takesNoParams_andReturnsVoid_butIsNotAnInstanceMethod()", key.usr: "s:23index_is_test_candidate0C54_takesNoParams_andReturnsVoid_butIsNotAnInstanceMethodyyF", key.line: 10, - key.column: 6 + key.column: 6, + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.struct, @@ -27,16 +28,19 @@ key.name: "test_startsWithTest_takesNoParams_returnsVoid_butIsDefinedOnAStruct()", key.usr: "s:23index_is_test_candidate8MyStructV0C63_startsWithTest_takesNoParams_returnsVoid_butIsDefinedOnAStructyyF", key.line: 13, - key.column: 8 + key.column: 8, + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.constructor, key.usr: "s:23index_is_test_candidate8MyStructVACycfc", key.line: 12, key.column: 8, - key.is_implicit: 1 + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.internal } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.class, @@ -50,9 +54,11 @@ key.usr: "s:23index_is_test_candidate10XCTestCaseCACycfc", key.line: 15, key.column: 7, - key.is_implicit: 1 + key.is_implicit: 1, + key.effective_access: source.decl.effective_access.internal } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.class, @@ -83,7 +89,8 @@ key.usr: "s:23index_is_test_candidate14MyPrivateClass33_E06F4E7BC5F577AB6E2EC6D3ECA1C8B9LLC0c47_startsWithTest_takesNoParams_returnsVoid_butIsF0yyF", key.line: 17, key.column: 8, - key.is_dynamic: 1 + key.is_dynamic: 1, + key.effective_access: source.decl.effective_access.fileprivate }, { key.kind: source.lang.swift.decl.function.constructor, @@ -102,7 +109,8 @@ { key.attribute: source.decl.attribute.override } - ] + ], + key.effective_access: source.decl.effective_access.fileprivate } ], key.attributes: [ @@ -110,7 +118,8 @@ key.attribute: source.decl.attribute.private } ], - key.is_test_candidate: 1 + key.is_test_candidate: 1, + key.effective_access: source.decl.effective_access.fileprivate }, { key.kind: source.lang.swift.decl.class, @@ -141,7 +150,8 @@ key.usr: "s:23index_is_test_candidate7MyClassC20doesNotStartWithTestyyF", key.line: 21, key.column: 8, - key.is_dynamic: 1 + key.is_dynamic: 1, + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.method.instance, @@ -158,7 +168,8 @@ key.line: 22, key.column: 50 } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.method.instance, @@ -175,7 +186,8 @@ key.line: 23, key.column: 68 } - ] + ], + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.method.instance, @@ -188,7 +200,8 @@ { key.attribute: source.decl.attribute.private } - ] + ], + key.effective_access: source.decl.effective_access.less_than_fileprivate }, { key.kind: source.lang.swift.decl.function.method.instance, @@ -197,7 +210,8 @@ key.line: 25, key.column: 8, key.is_dynamic: 1, - key.is_test_candidate: 1 + key.is_test_candidate: 1, + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.method.instance, @@ -206,7 +220,8 @@ key.line: 26, key.column: 8, key.is_dynamic: 1, - key.is_test_candidate: 1 + key.is_test_candidate: 1, + key.effective_access: source.decl.effective_access.internal }, { key.kind: source.lang.swift.decl.function.constructor, @@ -225,7 +240,8 @@ { key.attribute: source.decl.attribute.override } - ] + ], + key.effective_access: source.decl.effective_access.internal } ], key.attributes: [ @@ -233,7 +249,8 @@ key.attribute: source.decl.attribute.public } ], - key.is_test_candidate: 1 + key.is_test_candidate: 1, + key.effective_access: source.decl.effective_access.public } ] } From 8f2f14bbad855100ea53a7a93ee1da7f46fc0e2a Mon Sep 17 00:00:00 2001 From: Luciano Almeida Date: Fri, 29 May 2020 21:32:27 -0300 Subject: [PATCH 07/50] [CSSimplify] Modify logic on match representations to allow ONLY thick to thin and thick to thick representations on subtype context --- lib/Sema/CSSimplify.cpp | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/lib/Sema/CSSimplify.cpp b/lib/Sema/CSSimplify.cpp index 6c9a75fa68c27..9634273a77dd6 100644 --- a/lib/Sema/CSSimplify.cpp +++ b/lib/Sema/CSSimplify.cpp @@ -1353,16 +1353,41 @@ ConstraintSystem::matchTupleTypes(TupleType *tuple1, TupleType *tuple2, // corresponding function type representations and the given match kind. static bool matchFunctionRepresentations(FunctionTypeRepresentation rep1, FunctionTypeRepresentation rep2, - ConstraintKind kind) { + ConstraintKind kind, + ConstraintLocator *locator) { switch (kind) { case ConstraintKind::Bind: case ConstraintKind::BindParam: case ConstraintKind::BindToPointerType: case ConstraintKind::Equal: return rep1 != rep2; + + case ConstraintKind::Subtype: { + if (!locator->isLastElement()) + return false; + + auto isThin = [](FunctionTypeRepresentation rep) { + return rep == FunctionTypeRepresentation::CFunctionPointer || + rep == FunctionTypeRepresentation::Thin; + }; + + auto isThick = [](FunctionTypeRepresentation rep) { + return rep == FunctionTypeRepresentation::Swift || + rep == swift::FunctionTypeRepresentation::Block; + }; + + // Allowing conventions "thin" (c, thin) to "thick" (swift, block) + if (isThin(rep1) && isThick(rep2)) + return false; + + // Allowing conventions "thick" (swift, block) to "thick" (swift, block) + if (isThick(rep1) && isThick(rep2)) + return false; + + return rep1 != rep2; + } case ConstraintKind::OpaqueUnderlyingType: - case ConstraintKind::Subtype: case ConstraintKind::Conversion: case ConstraintKind::BridgingConversion: case ConstraintKind::ArgumentConversion: @@ -1657,7 +1682,7 @@ ConstraintSystem::matchFunctionTypes(FunctionType *func1, FunctionType *func2, if (matchFunctionRepresentations(func1->getExtInfo().getRepresentation(), func2->getExtInfo().getRepresentation(), - kind)) { + kind, getConstraintLocator(locator))) { return getTypeMatchFailure(locator); } From bacbc574a7f5ae05a91a1babcb41b5a4e8242ce7 Mon Sep 17 00:00:00 2001 From: Luciano Almeida Date: Fri, 29 May 2020 21:33:22 -0300 Subject: [PATCH 08/50] [tests] Adding silgen validation tests for SR-12723 to ensure that certain representation convertions do not crash --- .../compiler_crashers_2_fixed/sr12723.swift | 83 +++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 validation-test/compiler_crashers_2_fixed/sr12723.swift diff --git a/validation-test/compiler_crashers_2_fixed/sr12723.swift b/validation-test/compiler_crashers_2_fixed/sr12723.swift new file mode 100644 index 0000000000000..2a4e227c9dd42 --- /dev/null +++ b/validation-test/compiler_crashers_2_fixed/sr12723.swift @@ -0,0 +1,83 @@ +// RUN: %target-swift-emit-silgen %s -verify + +func SR12723_thin(_: (@convention(thin) () -> Void) -> Void) {} +func SR12723_block(_: (@convention(block) () -> Void) -> Void) {} +func SR12723_c(_: (@convention(c) () -> Void) -> Void) {} + +func SR12723_function(_: () -> Void) {} + +func context() { + SR12723_c(SR12723_function) + + SR12723_block(SR12723_function) + + SR12723_thin(SR12723_function) +} + +struct SR12723_C { + let function: (@convention(c) () -> Void) -> Void +} + +struct SR12723_Thin { + let function: (@convention(thin) () -> Void) -> Void +} + +struct SR12723_Block { + let function: (@convention(block) () -> Void) -> Void +} + +func proxy(_ f: (() -> Void) -> Void) { + let a = 1 + f { print(a) } +} + +func cContext() { + let c = SR12723_C { app in app() } + + proxy(c.function) + // expected-error@-1 {{cannot convert value of type '(@convention(c) () -> Void) -> Void' to expected argument type '(() -> Void) -> Void'}} + + let _ : (@convention(block) () -> Void) -> Void = c.function + // expected-error@-1 {{cannot convert value of type '(@convention(c) () -> Void) -> Void' to specified type '(@convention(block) () -> Void) -> Void'}} + + let _ : (@convention(c) () -> Void) -> Void = c.function // OK + + let _ : (@convention(thin) () -> Void) -> Void = c.function + // expected-error@-1 {{cannot convert value of type '(@convention(c) () -> Void) -> Void' to specified type '(@convention(thin) () -> Void) -> Void'}} + + let _ : (() -> Void) -> Void = c.function + // expected-error@-1 {{cannot convert value of type '(@convention(c) () -> Void) -> Void' to specified type '(() -> Void) -> Void'}} + +} + +func thinContext() { + let thin = SR12723_Thin { app in app() } + + proxy(thin.function) + // expected-error@-1 {{cannot convert value of type '(@convention(thin) () -> Void) -> Void' to expected argument type '(() -> Void) -> Void'}} + + let _ : (@convention(block) () -> Void) -> Void = thin.function + // expected-error@-1 {{cannot convert value of type '(@convention(thin) () -> Void) -> Void' to specified type '(@convention(block) () -> Void) -> Void'}} + + let _ : (@convention(c) () -> Void) -> Void = thin.function + // expected-error@-1 {{cannot convert value of type '(@convention(thin) () -> Void) -> Void' to specified type '(@convention(c) () -> Void) -> Void'}} + + let _ : (@convention(thin) () -> Void) -> Void = thin.function // OK + + let _ : (() -> Void) -> Void = thin.function + // expected-error@-1 {{cannot convert value of type '(@convention(thin) () -> Void) -> Void' to specified type '(() -> Void) -> Void'}} +} + +func blockContext() { + let block = SR12723_Block { app in app() } + + proxy(block.function) + + let _ : (@convention(block) () -> Void) -> Void = block.function // OK + + let _ : (@convention(c) () -> Void) -> Void = block.function // OK + + let _ : (@convention(thin) () -> Void) -> Void = block.function // OK + + let _ : (() -> Void) -> Void = block.function // OK +} From baccbde0d1ae1c049794c4180e013a4cf0b6909b Mon Sep 17 00:00:00 2001 From: Luciano Almeida Date: Tue, 2 Jun 2020 06:25:05 -0300 Subject: [PATCH 09/50] [CSSimplify] Simplify logic for valiting to thick conversion on subtype --- lib/Sema/CSSimplify.cpp | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/lib/Sema/CSSimplify.cpp b/lib/Sema/CSSimplify.cpp index 9634273a77dd6..e23580153ac8b 100644 --- a/lib/Sema/CSSimplify.cpp +++ b/lib/Sema/CSSimplify.cpp @@ -1354,7 +1354,7 @@ ConstraintSystem::matchTupleTypes(TupleType *tuple1, TupleType *tuple2, static bool matchFunctionRepresentations(FunctionTypeRepresentation rep1, FunctionTypeRepresentation rep2, ConstraintKind kind, - ConstraintLocator *locator) { + ConstraintLocatorBuilder locator) { switch (kind) { case ConstraintKind::Bind: case ConstraintKind::BindParam: @@ -1363,25 +1363,14 @@ static bool matchFunctionRepresentations(FunctionTypeRepresentation rep1, return rep1 != rep2; case ConstraintKind::Subtype: { - if (!locator->isLastElement()) - return false; - - auto isThin = [](FunctionTypeRepresentation rep) { - return rep == FunctionTypeRepresentation::CFunctionPointer || - rep == FunctionTypeRepresentation::Thin; - }; - - auto isThick = [](FunctionTypeRepresentation rep) { - return rep == FunctionTypeRepresentation::Swift || - rep == swift::FunctionTypeRepresentation::Block; - }; - - // Allowing conventions "thin" (c, thin) to "thick" (swift, block) - if (isThin(rep1) && isThick(rep2)) + auto last = locator.last(); + if (!(last && last->is())) return false; - // Allowing conventions "thick" (swift, block) to "thick" (swift, block) - if (isThick(rep1) && isThick(rep2)) + // Allowing all to "thick" (swift, block) conventions + // "thin" (c, thin) to "thick" or "thick" to "thick" + if (rep2 == FunctionTypeRepresentation::Swift || + rep2 == FunctionTypeRepresentation::Block) return false; return rep1 != rep2; @@ -1682,7 +1671,7 @@ ConstraintSystem::matchFunctionTypes(FunctionType *func1, FunctionType *func2, if (matchFunctionRepresentations(func1->getExtInfo().getRepresentation(), func2->getExtInfo().getRepresentation(), - kind, getConstraintLocator(locator))) { + kind, locator)) { return getTypeMatchFailure(locator); } From d6bf34e65ccaca00821c9c3d2ac06ab6bcfe540c Mon Sep 17 00:00:00 2001 From: Luciano Almeida Date: Fri, 5 Jun 2020 06:11:01 -0300 Subject: [PATCH 10/50] [CSSimplify] Thin to thin is also allowed --- lib/Sema/CSSimplify.cpp | 9 +++++++++ validation-test/compiler_crashers_2_fixed/sr12723.swift | 8 +++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/Sema/CSSimplify.cpp b/lib/Sema/CSSimplify.cpp index e23580153ac8b..05ac6ad828af5 100644 --- a/lib/Sema/CSSimplify.cpp +++ b/lib/Sema/CSSimplify.cpp @@ -1367,6 +1367,15 @@ static bool matchFunctionRepresentations(FunctionTypeRepresentation rep1, if (!(last && last->is())) return false; + auto isThin = [](FunctionTypeRepresentation rep) { + return rep == FunctionTypeRepresentation::CFunctionPointer || + rep == FunctionTypeRepresentation::Thin; + }; + + // Allowing "thin" (c, thin) to "thin" conventions + if (isThin(rep1) && isThin(rep2)) + return false; + // Allowing all to "thick" (swift, block) conventions // "thin" (c, thin) to "thick" or "thick" to "thick" if (rep2 == FunctionTypeRepresentation::Swift || diff --git a/validation-test/compiler_crashers_2_fixed/sr12723.swift b/validation-test/compiler_crashers_2_fixed/sr12723.swift index 2a4e227c9dd42..b04103a9f7a8e 100644 --- a/validation-test/compiler_crashers_2_fixed/sr12723.swift +++ b/validation-test/compiler_crashers_2_fixed/sr12723.swift @@ -42,9 +42,8 @@ func cContext() { let _ : (@convention(c) () -> Void) -> Void = c.function // OK - let _ : (@convention(thin) () -> Void) -> Void = c.function - // expected-error@-1 {{cannot convert value of type '(@convention(c) () -> Void) -> Void' to specified type '(@convention(thin) () -> Void) -> Void'}} - + let _ : (@convention(thin) () -> Void) -> Void = c.function // OK + let _ : (() -> Void) -> Void = c.function // expected-error@-1 {{cannot convert value of type '(@convention(c) () -> Void) -> Void' to specified type '(() -> Void) -> Void'}} @@ -59,8 +58,7 @@ func thinContext() { let _ : (@convention(block) () -> Void) -> Void = thin.function // expected-error@-1 {{cannot convert value of type '(@convention(thin) () -> Void) -> Void' to specified type '(@convention(block) () -> Void) -> Void'}} - let _ : (@convention(c) () -> Void) -> Void = thin.function - // expected-error@-1 {{cannot convert value of type '(@convention(thin) () -> Void) -> Void' to specified type '(@convention(c) () -> Void) -> Void'}} + let _ : (@convention(c) () -> Void) -> Void = thin.function // OK let _ : (@convention(thin) () -> Void) -> Void = thin.function // OK From 346771f82a4dc72e49253f21f9c45a0fdbb99907 Mon Sep 17 00:00:00 2001 From: Bruno Rocha Date: Tue, 9 Jun 2020 08:12:37 +0200 Subject: [PATCH 11/50] Update tools/SourceKit/lib/SwiftLang/SwiftIndexing.cpp Co-authored-by: Xiaodi Wu <13952+xwu@users.noreply.github.com> --- tools/SourceKit/lib/SwiftLang/SwiftIndexing.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/SourceKit/lib/SwiftLang/SwiftIndexing.cpp b/tools/SourceKit/lib/SwiftLang/SwiftIndexing.cpp index 0bfc29a0ae24c..deff6db7eef8f 100644 --- a/tools/SourceKit/lib/SwiftLang/SwiftIndexing.cpp +++ b/tools/SourceKit/lib/SwiftLang/SwiftIndexing.cpp @@ -158,7 +158,7 @@ class SKIndexDataConsumer : public IndexDataConsumer { case SymbolSubKind::SwiftGenericTypeParam: return false; default: - break; + break; } switch (Kind) { case SymbolKind::Enum: From 2b4781597346ec9cc2ab2cb209317606ed0d9ea5 Mon Sep 17 00:00:00 2001 From: Arnold Schwaighofer Date: Tue, 9 Jun 2020 13:03:35 -0700 Subject: [PATCH 12/50] IRGen: Lookup the conformance of an archetype in the right substitution map when computing necessary bindings of abstract cnditional requirements SR-12853 --- lib/IRGen/GenProto.cpp | 7 +++++-- test/IRGen/partial_apply_forwarder.sil | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/IRGen/GenProto.cpp b/lib/IRGen/GenProto.cpp index 2cb7ba801893d..7c54d83598f0e 100644 --- a/lib/IRGen/GenProto.cpp +++ b/lib/IRGen/GenProto.cpp @@ -2749,9 +2749,12 @@ static void addAbstractConditionalRequirements( auto *proto = req.getSecondType()->castTo()->getDecl(); auto ty = req.getFirstType()->getCanonicalType(); - if (!isa(ty)) + auto archetype = dyn_cast(ty); + if (!archetype) continue; - auto conformance = subMap.lookupConformance(ty, proto); + auto *genericEnv = archetype->getGenericEnvironment(); + auto conformance = + genericEnv->getForwardingSubstitutionMap().lookupConformance(ty, proto); if (!conformance.isAbstract()) continue; requirements.insert({ty, conformance.getAbstract()}); diff --git a/test/IRGen/partial_apply_forwarder.sil b/test/IRGen/partial_apply_forwarder.sil index 50ead1c5882c4..d54dbf3f118c3 100644 --- a/test/IRGen/partial_apply_forwarder.sil +++ b/test/IRGen/partial_apply_forwarder.sil @@ -291,7 +291,7 @@ bb0(%0 : $Outer>): return %15 : $() } -sil @$dont_crash_test_capture_specialized_conditional_conformance_nested : $@convention(thin) (Outer>) -> () { +sil @$dont_crash_test_capture_specialized_conditional_conformance_nested : $@convention(thin) (Outer>) -> () { bb0(%0 : $Outer>): %4 = metatype $@thin Outermost>>.Type %5 = function_ref @$closure2 : $@convention(method) (Outermost, Outermost, @thin Outermost.Type) -> Builtin.Int1 From adba283a00eb7332c4ff8b27bf51f8bad9a08555 Mon Sep 17 00:00:00 2001 From: Luciano Almeida Date: Tue, 9 Jun 2020 06:19:54 -0300 Subject: [PATCH 13/50] [CSSimplify] Abstract function conversion validation into static method --- lib/Sema/CSSimplify.cpp | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/lib/Sema/CSSimplify.cpp b/lib/Sema/CSSimplify.cpp index 05ac6ad828af5..252fb22c95f0c 100644 --- a/lib/Sema/CSSimplify.cpp +++ b/lib/Sema/CSSimplify.cpp @@ -1349,6 +1349,29 @@ ConstraintSystem::matchTupleTypes(TupleType *tuple1, TupleType *tuple2, return getTypeMatchSuccess(); } +// Determine if a function representation conversion is allowed returning +// 'false' (i.e. no error) if the conversion is valid. +static bool +matchFunctionConversionRepresentations(FunctionTypeRepresentation rep1, + FunctionTypeRepresentation rep2) { + auto isThin = [](FunctionTypeRepresentation rep) { + return rep == FunctionTypeRepresentation::CFunctionPointer || + rep == FunctionTypeRepresentation::Thin; + }; + + // Allowing "thin" (c, thin) to "thin" conventions + if (isThin(rep1) && isThin(rep2)) + return false; + + // Allowing all to "thick" (swift, block) conventions + // "thin" (c, thin) to "thick" or "thick" to "thick" + if (rep2 == FunctionTypeRepresentation::Swift || + rep2 == FunctionTypeRepresentation::Block) + return false; + + return rep1 != rep2; +} + // Returns 'false' (i.e. no error) if it is legal to match functions with the // corresponding function type representations and the given match kind. static bool matchFunctionRepresentations(FunctionTypeRepresentation rep1, @@ -1367,22 +1390,7 @@ static bool matchFunctionRepresentations(FunctionTypeRepresentation rep1, if (!(last && last->is())) return false; - auto isThin = [](FunctionTypeRepresentation rep) { - return rep == FunctionTypeRepresentation::CFunctionPointer || - rep == FunctionTypeRepresentation::Thin; - }; - - // Allowing "thin" (c, thin) to "thin" conventions - if (isThin(rep1) && isThin(rep2)) - return false; - - // Allowing all to "thick" (swift, block) conventions - // "thin" (c, thin) to "thick" or "thick" to "thick" - if (rep2 == FunctionTypeRepresentation::Swift || - rep2 == FunctionTypeRepresentation::Block) - return false; - - return rep1 != rep2; + return matchFunctionConversionRepresentations(rep1, rep2); } case ConstraintKind::OpaqueUnderlyingType: From 478e13b9c96040163556dc9d22f972ad616aa3e5 Mon Sep 17 00:00:00 2001 From: Arnold Schwaighofer Date: Wed, 10 Jun 2020 06:28:27 -0700 Subject: [PATCH 14/50] Address review feedback --- lib/IRGen/GenProto.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/IRGen/GenProto.cpp b/lib/IRGen/GenProto.cpp index 7c54d83598f0e..0b28c73308c2a 100644 --- a/lib/IRGen/GenProto.cpp +++ b/lib/IRGen/GenProto.cpp @@ -2749,14 +2749,13 @@ static void addAbstractConditionalRequirements( auto *proto = req.getSecondType()->castTo()->getDecl(); auto ty = req.getFirstType()->getCanonicalType(); - auto archetype = dyn_cast(ty); + auto archetype = dyn_cast(ty); if (!archetype) continue; auto *genericEnv = archetype->getGenericEnvironment(); auto conformance = genericEnv->getForwardingSubstitutionMap().lookupConformance(ty, proto); - if (!conformance.isAbstract()) - continue; + assert(conformance.isAbstract()); requirements.insert({ty, conformance.getAbstract()}); } // Recursively add conditional requirements. From ea8c9b85119954fa7bf617998e32c1f16e843280 Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Tue, 9 Jun 2020 21:59:31 -0700 Subject: [PATCH 15/50] gyb: use a stable hash for Syntax This changes the hash from the Python `hash` function to SHA1. Python 3 adopted SIP as the hashing algorithm which changed the hash results. We could no longer use a different python interpreter across the builds. A stable hashing algorithm allows easier migration. --- utils/gyb_syntax_support/__init__.py | 37 ++++++++++++++-------------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/utils/gyb_syntax_support/__init__.py b/utils/gyb_syntax_support/__init__.py index b24c5387b7497..1f58d26dbfe67 100644 --- a/utils/gyb_syntax_support/__init__.py +++ b/utils/gyb_syntax_support/__init__.py @@ -1,3 +1,4 @@ +import hashlib import textwrap from . import Classification # noqa: I201 from . import Token @@ -143,34 +144,34 @@ def dedented_lines(description): return textwrap.dedent(description).split('\n') -def hash_syntax_node(node): +def digest_syntax_node(digest, node): # Hash into the syntax name and serialization code - result = hash((node.name, get_serialization_code(node.syntax_kind))) + digest.update(node.name) + digest.update(str(get_serialization_code(node.syntax_kind))) for child in node.children: # Hash into the expected child syntax - result = hash((result, child.syntax_kind)) + digest.update(child.syntax_kind) # Hash into the child name - result = hash((result, child.name)) + digest.update(child.name) # Hash into whether the child is optional - result = hash((result, child.is_optional)) - return result + digest.update(str(child.is_optional)) -def hash_token_syntax(token): +def digest_syntax_token(digest, token): # Hash into the token name and serialization code - return hash((token.name, token.serialization_code)) + digest.update(token.name) + digest.update(str(token.serialization_code)) -def hash_trivia(trivia): - return hash((trivia.name, trivia.serialization_code, trivia.characters)) +def digest_trivia(digest, trivia): + digest.update(trivia.name) + digest.update(str(trivia.serialization_code)) + digest.update(str(trivia.characters)) def calculate_node_hash(): - result = 0 - for node in SYNTAX_NODES: - result = hash((result, hash_syntax_node(node))) - for token in SYNTAX_TOKENS: - result = hash((result, hash_token_syntax(token))) - for trivia in TRIVIAS: - result = hash((result, hash_trivia(trivia))) - return result + digest = hashlib.sha1() + map(lambda node: digest_syntax_node(digest, node), SYNTAX_NODES) + map(lambda token: digest_syntax_token(digest, token), SYNTAX_TOKENS) + map(lambda trivia: digest_trivia(digest, trivia), TRIVIAS) + return digest.hexdigest() From 8a2bfb046b358cb429b5e8c1eff602d4578c6f5c Mon Sep 17 00:00:00 2001 From: Arnold Schwaighofer Date: Thu, 11 Jun 2020 07:15:36 -0700 Subject: [PATCH 16/50] No need to lookup the conformance we can just take the protocol from the requirement --- lib/IRGen/GenProto.cpp | 6 +----- test/IRGen/partial_apply_forwarder.sil | 22 +++++++++++++++++++++- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/lib/IRGen/GenProto.cpp b/lib/IRGen/GenProto.cpp index 0b28c73308c2a..3e7d81c2ca5fd 100644 --- a/lib/IRGen/GenProto.cpp +++ b/lib/IRGen/GenProto.cpp @@ -2752,11 +2752,7 @@ static void addAbstractConditionalRequirements( auto archetype = dyn_cast(ty); if (!archetype) continue; - auto *genericEnv = archetype->getGenericEnvironment(); - auto conformance = - genericEnv->getForwardingSubstitutionMap().lookupConformance(ty, proto); - assert(conformance.isAbstract()); - requirements.insert({ty, conformance.getAbstract()}); + requirements.insert({ty, proto}); } // Recursively add conditional requirements. for (auto &conf : subMap.getConformances()) { diff --git a/test/IRGen/partial_apply_forwarder.sil b/test/IRGen/partial_apply_forwarder.sil index d54dbf3f118c3..9c155222a0812 100644 --- a/test/IRGen/partial_apply_forwarder.sil +++ b/test/IRGen/partial_apply_forwarder.sil @@ -255,6 +255,9 @@ protocol MyEquatable { static func isEqual (lhs: Self, rhs: Self) -> Builtin.Int1 } +protocol MyExtended : MyEquatable { + func extended() +} public struct Inner { public init() public init(_ e: Element) @@ -278,7 +281,7 @@ public struct Outermost { sil @$closure : $@convention(method) (Outer, Outer, @thin Outer.Type) -> Builtin.Int1 sil @$closure2 : $@convention(method) (Outermost, Outermost, @thin Outermost.Type) -> Builtin.Int1 -sil @$dont_crash_test_capture_specialized_conditional_conformance : $@convention(thin) (Outer>) -> () { +sil @$dont_crash_test_capture_specialized_conditional_conformance : $@convention(thin) (Outer>) -> () { bb0(%0 : $Outer>): %2 = alloc_stack $Outer> store %0 to %2 : $*Outer> @@ -291,6 +294,23 @@ bb0(%0 : $Outer>): return %15 : $() } +protocol AssocType { + associatedtype A : MyExtended +} + +sil @$dont_crash_test_capture_specialized_conditional_conformance_associated_type : $@convention(thin) (Outer>) -> () { +bb0(%0 : $Outer>): + %2 = alloc_stack $Outer> + store %0 to %2 : $*Outer> + %4 = metatype $@thin Outer>.Type + %5 = function_ref @$closure : $@convention(method) <τ_0_0 where τ_0_0 : MyEquatable> (Outer<τ_0_0>, Outer<τ_0_0>, @thin Outer<τ_0_0>.Type) -> Builtin.Int1 + %6 = partial_apply [callee_guaranteed] %5>(%4) : $@convention(method) <τ_0_0 where τ_0_0 : MyEquatable> (Outer<τ_0_0>, Outer<τ_0_0>, @thin Outer<τ_0_0>.Type) -> Builtin.Int1 + strong_release %6 : $@callee_guaranteed (Outer>, Outer>) -> Builtin.Int1 + dealloc_stack %2 : $*Outer> + %15 = tuple () + return %15 : $() +} + sil @$dont_crash_test_capture_specialized_conditional_conformance_nested : $@convention(thin) (Outer>) -> () { bb0(%0 : $Outer>): %4 = metatype $@thin Outermost>>.Type From 632b5ce0c8588368cd847bc17ddbf72c2f50e0e6 Mon Sep 17 00:00:00 2001 From: Meghana Gupta Date: Thu, 11 Jun 2020 09:52:11 -0700 Subject: [PATCH 17/50] Ignore OnFastPath builtin while looking for valid static initializer of a global variable --- lib/SIL/IR/SILGlobalVariable.cpp | 2 ++ test/SILOptimizer/optionset.swift | 33 +++++++++++++------------------ 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/lib/SIL/IR/SILGlobalVariable.cpp b/lib/SIL/IR/SILGlobalVariable.cpp index a7473bbd287e6..9c0493016f056 100644 --- a/lib/SIL/IR/SILGlobalVariable.cpp +++ b/lib/SIL/IR/SILGlobalVariable.cpp @@ -136,6 +136,8 @@ bool SILGlobalVariable::isValidStaticInitializerInst(const SILInstruction *I, auto *TE = bi->getSingleUserOfType(); return TE && getOffsetSubtract(TE, M); } + case BuiltinValueKind::OnFastPath: + return true; default: break; } diff --git a/test/SILOptimizer/optionset.swift b/test/SILOptimizer/optionset.swift index 6e332bc27281e..4890c8bb5ca5a 100644 --- a/test/SILOptimizer/optionset.swift +++ b/test/SILOptimizer/optionset.swift @@ -12,7 +12,13 @@ public struct TestOptions: OptionSet { static let fourth = TestOptions(rawValue: 1 << 3) } -// CHECK: sil @{{.*}}returnTestOptions{{.*}} +// CHECK-LABEL: sil_global hidden [let] @$s4test17globalTestOptionsAA0cD0Vvp : $TestOptions = { +// CHECK: [[CONST:%.*]] = integer_literal $Builtin.Int{{32|64}}, 15 +// CHECK: [[INT:%.*]] = struct $Int (%0 : $Builtin.Int{{32|64}}) +// CHECK: %initval = struct $TestOptions ([[INT]] : $Int) +let globalTestOptions: TestOptions = [.first, .second, .third, .fourth] + +// CHECK-LABEL: sil @{{.*}}returnTestOptions{{.*}} // CHECK-NEXT: bb0: // CHECK-NEXT: builtin // CHECK-NEXT: integer_literal {{.*}}, 15 @@ -23,24 +29,13 @@ public func returnTestOptions() -> TestOptions { return [.first, .second, .third, .fourth] } -// CHECK: sil @{{.*}}returnEmptyTestOptions{{.*}} -// CHECK: [[ZERO:%[0-9]+]] = integer_literal {{.*}}, 0 -// CHECK: [[ZEROINT:%[0-9]+]] = struct $Int ([[ZERO]] -// CHECK: [[TO:%[0-9]+]] = struct $TestOptions ([[ZEROINT]] -// CHECK: return [[TO]] -// CHECK: } // end sil function {{.*}}returnEmptyTestOptions{{.*}} -public func returnEmptyTestOptions() -> TestOptions { - return [] -} - -// CHECK: alloc_global @{{.*}}globalTestOptions{{.*}} -// CHECK-NEXT: global_addr -// CHECK-NEXT: builtin -// CHECK-NEXT: integer_literal {{.*}}, 15 +// CHECK-LABEL: sil @{{.*}}returnEmptyTestOptions{{.*}} +// CHECK-NEXT: bb0: +// CHECK-NEXT: integer_literal {{.*}}, 0 +// CHECK-NEXT: builtin "onFastPath"() : $() // CHECK-NEXT: struct $Int // CHECK-NEXT: struct $TestOptions -// CHECK-NEXT: store -// CHECK-NEXT: tuple // CHECK-NEXT: return -let globalTestOptions: TestOptions = [.first, .second, .third, .fourth] - +public func returnEmptyTestOptions() -> TestOptions { + return [] +} From 0fc6a941845e40e59b27f5052774c578416cd3ad Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Thu, 11 Jun 2020 14:31:49 -0700 Subject: [PATCH 18/50] [test/Syntax/round_trip_stdlib.swift] Exclude the test for an ASAN build It is too slow, rdar://64215520 --- test/Syntax/round_trip_stdlib.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/Syntax/round_trip_stdlib.swift b/test/Syntax/round_trip_stdlib.swift index ccc214adff588..0d9eac0546e4a 100644 --- a/test/Syntax/round_trip_stdlib.swift +++ b/test/Syntax/round_trip_stdlib.swift @@ -1 +1,3 @@ +// test/Syntax/round_trip_stdlib.swift is very slow on ASAN build +// REQUIRES: no_asan // RUN: %round-trip-syntax-test -d %swift_src_root/stdlib --swift-syntax-test %swift-syntax-test From addb4329d0abac88f7d585df6aa8210f694d80ea Mon Sep 17 00:00:00 2001 From: Luciano Almeida Date: Thu, 11 Jun 2020 20:17:38 -0300 Subject: [PATCH 19/50] [TypeCheckType] Avoid diagnose convention representation when function type has error type --- lib/Sema/TypeCheckType.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Sema/TypeCheckType.cpp b/lib/Sema/TypeCheckType.cpp index 3f368011f8aa1..fc03b2ce4c8b5 100644 --- a/lib/Sema/TypeCheckType.cpp +++ b/lib/Sema/TypeCheckType.cpp @@ -2705,7 +2705,8 @@ Type TypeResolver::resolveASTFunctionType( switch (representation) { case AnyFunctionType::Representation::Block: case AnyFunctionType::Representation::CFunctionPointer: - if (!fnTy->isRepresentableIn(ForeignLanguage::ObjectiveC, DC)) { + if (!fnTy->hasError() && + !fnTy->isRepresentableIn(ForeignLanguage::ObjectiveC, DC)) { StringRef strName = (representation == AnyFunctionType::Representation::Block) ? "block" From 384c3735e8f8de625aea810fa62ed2c7228a7b48 Mon Sep 17 00:00:00 2001 From: Luciano Almeida Date: Thu, 11 Jun 2020 20:18:12 -0300 Subject: [PATCH 20/50] [tests] Add regression test for SR-12955 --- test/expr/closure/inference.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/expr/closure/inference.swift b/test/expr/closure/inference.swift index a63f5cbe39641..b1b536c53991f 100644 --- a/test/expr/closure/inference.swift +++ b/test/expr/closure/inference.swift @@ -73,3 +73,8 @@ let cc = SR8563 { (_: (Int)) in } cc((1)) // Ok cc(1) // Ok + +// SR-12955 +func SR12955() { + let f: @convention(c) (T) -> Void // expected-error {{cannot find type 'T' in scope}} +} From a7b3e37471fb4e3ffcc737f2fec72111e70e2a60 Mon Sep 17 00:00:00 2001 From: Michael Gottesman Date: Thu, 11 Jun 2020 22:19:51 -0700 Subject: [PATCH 21/50] [build-script] Print out inferred products/build order when --verbose-build is enabled. --- utils/build-script | 11 ++++++++ .../infer_dumps_deps_if_verbose_build.test | 26 +++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 validation-test/BuildSystem/infer_dumps_deps_if_verbose_build.test diff --git a/utils/build-script b/utils/build-script index 4d47122f20c03..47ef2165b7766 100755 --- a/utils/build-script +++ b/utils/build-script @@ -889,6 +889,11 @@ class BuildScriptInvocation(object): # list. if self.args.infer_dependencies: combined = impl_product_classes + product_classes + if self.args.verbose_build: + print("-- Build Graph Inference --") + print("Initial Product List:") + for p in combined: + print(" {}".format(p.product_name())) # Now that we have produced the schedule, resplit. We require our # dependencies to respect our build-script-impl property. This means @@ -908,6 +913,12 @@ class BuildScriptInvocation(object): impl_product_classes.append(p) else: product_classes.append(p) + if self.args.verbose_build: + print("Final Build Order:") + for p in impl_product_classes: + print(" {}".format(p.product_name())) + for p in product_classes: + print(" {}".format(p.product_name())) return (impl_product_classes, product_classes) def execute(self): diff --git a/validation-test/BuildSystem/infer_dumps_deps_if_verbose_build.test b/validation-test/BuildSystem/infer_dumps_deps_if_verbose_build.test new file mode 100644 index 0000000000000..0bb88a9672113 --- /dev/null +++ b/validation-test/BuildSystem/infer_dumps_deps_if_verbose_build.test @@ -0,0 +1,26 @@ +# RUN: %empty-directory(%t) +# RUN: mkdir -p %t +# RUN: SWIFT_BUILD_ROOT=%t %swift_src_root/utils/build-script --verbose-build --dry-run --infer --swiftpm --cmake %cmake 2>&1 | %FileCheck %s + +# REQUIRES: standalone_build + +# Just make sure we compute the build graph/emit output. +# +# CHECK: -- Build Graph Inference -- +# CHECK: Initial Product List: +# CHECK: cmark +# CHECK: llvm +# CHECK: swift +# CHECK: Final Build Order: +# CHECK: cmark +# CHECK: llvm +# CHECK: swift + +# Then make sure we are installing/building at the appropriate times. +# +# CHECK: --- Installing cmark --- +# CHECK: --- Installing llvm --- +# CHECK: --- Installing swift --- +# CHECK: --- Installing llbuild --- +# CHECK: --- Building swiftpm --- +# CHECK: --- Installing swiftpm --- From 0c332067beb15f95c3637924ee1f3828e577fadc Mon Sep 17 00:00:00 2001 From: Luciano Almeida Date: Fri, 12 Jun 2020 07:08:14 -0300 Subject: [PATCH 22/50] [Type] Fail early on Type::getForeignRepresentable if type has error --- lib/AST/Type.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp index 192a85ff30e6c..ce805c53898f1 100644 --- a/lib/AST/Type.cpp +++ b/lib/AST/Type.cpp @@ -2208,6 +2208,16 @@ getObjCObjectRepresentable(Type type, const DeclContext *dc) { static std::pair getForeignRepresentable(Type type, ForeignLanguage language, const DeclContext *dc) { + // Local function that simply produces a failing result. + auto failure = []() -> std::pair { + return { ForeignRepresentableKind::None, nullptr }; + }; + + // If type has an error let's fail early. + if (type->hasError()) + return failure(); + // Look through one level of optional type, but remember that we did. bool wasOptional = false; if (auto valueType = type->getOptionalObjectType()) { @@ -2222,12 +2232,6 @@ getForeignRepresentable(Type type, ForeignLanguage language, return { representable, nullptr }; } - // Local function that simply produces a failing result. - auto failure = []() -> std::pair { - return { ForeignRepresentableKind::None, nullptr }; - }; - // Function types. if (auto functionType = type->getAs()) { // Cannot handle throwing functions. From 8e832b6be001472ea855577e5052e1cd1242195b Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Fri, 12 Jun 2020 09:09:19 -0700 Subject: [PATCH 23/50] Update WindowsBuild.md Explicitly use the path to pyhon2.7 (although the tool can support python 3.x, the path is much much unwieldy as `"C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\python.exe"` --- docs/WindowsBuild.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/WindowsBuild.md b/docs/WindowsBuild.md index 119496aa4cade..86ddaf91be1fb 100644 --- a/docs/WindowsBuild.md +++ b/docs/WindowsBuild.md @@ -79,12 +79,12 @@ git clone https://github.com/compnerd/swift-build swift-build ## Acquire ICU, SQLite3, curl, libxml2 and zlib ``` -python -m pip install --user msrest azure-devops tabulate -python swift-build\utilities\swift-build.py --build-id ICU --latest-artifacts --filter windows-x64 --download -python swift-build\utilities\swift-build.py --build-id XML2 --latest-artifacts --filter windows-x64 --download -python swift-build\utilities\swift-build.py --build-id CURL --latest-artifacts --filter windows-x64 --download -python swift-build\utilities\swift-build.py --build-id zlib --latest-artifacts --filter windows-x64 --download -python swift-build\utilities\swift-build.py --build-id SQLite --latest-artifacts --filter windows-x64 --download +C:\Python27\python.exe -m pip install --user msrest azure-devops tabulate +C:\Python27\python.exe swift-build\utilities\swift-build.py --build-id ICU --latest-artifacts --filter windows-x64 --download +C:\Python27\python.exe swift-build\utilities\swift-build.py --build-id XML2 --latest-artifacts --filter windows-x64 --download +C:\Python27\python.exe swift-build\utilities\swift-build.py --build-id CURL --latest-artifacts --filter windows-x64 --download +C:\Python27\python.exe swift-build\utilities\swift-build.py --build-id zlib --latest-artifacts --filter windows-x64 --download +C:\Python27\python.exe swift-build\utilities\swift-build.py --build-id SQLite --latest-artifacts --filter windows-x64 --download ``` Extract the zip files, ignoring the top level directory, into `S:/Library`. The directory structure should resemble: From 306cb0d925ee9e4c8142a57729ded747f44c08f8 Mon Sep 17 00:00:00 2001 From: Mike Ash Date: Fri, 12 Jun 2020 13:00:41 -0400 Subject: [PATCH 24/50] [Test] Exclude environment_variables.swift from testing against the OS stdlib. rdar://problem/64301166 --- test/Runtime/environment_variables.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/test/Runtime/environment_variables.swift b/test/Runtime/environment_variables.swift index c62a74c4b5e74..329ae76ea5ce1 100644 --- a/test/Runtime/environment_variables.swift +++ b/test/Runtime/environment_variables.swift @@ -3,6 +3,7 @@ // RUN: %target-codesign %t/main // REQUIRES: executable_test +// UNSUPPORTED: use_os_stdlib // RUN: env %env-SWIFT_DEBUG_HELP=YES %env-SWIFT_DEBUG_SOME_UNKNOWN_VARIABLE=42 %env-SWIFT_DEBUG_ENABLE_METADATA_ALLOCATION_ITERATION=YES %env-SWIFT_DEBUG_IMPLICIT_OBJC_ENTRYPOINT=abc %env-SWIFT_DETERMINISTIC_HASHING=whatever %env-SWIFT_ENABLE_MANGLED_NAME_VERIFICATION=YES %target-run %t/main 2>&1 | %FileCheck %s --dump-input fail From 1d533624c2389707f878c7c36673919c9bca5509 Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Fri, 12 Jun 2020 10:45:04 -0700 Subject: [PATCH 25/50] vim: treat `associatedtype` as `typealias` for highlighting --- utils/vim/syntax/swift.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/vim/syntax/swift.vim b/utils/vim/syntax/swift.vim index 2928550b4adb8..14dec4bfa5a37 100644 --- a/utils/vim/syntax/swift.vim +++ b/utils/vim/syntax/swift.vim @@ -16,7 +16,6 @@ if exists("b:current_syntax") endif syn keyword swiftKeyword - \ associatedtype \ break \ catch \ continue @@ -92,6 +91,7 @@ syn keyword swiftTypeDefinition skipwhite skipempty nextgroup=swiftTypeName \ struct syn keyword swiftTypeAliasDefinition skipwhite skipempty nextgroup=swiftTypeAliasName + \ associatedtype \ typealias syn match swiftMultiwordTypeDefinition skipwhite skipempty nextgroup=swiftTypeName From 22006e376cb3812a47466379e15aca55c1694d2d Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Fri, 12 Jun 2020 10:45:39 -0700 Subject: [PATCH 26/50] vim: add some missing keywords for highlighting --- utils/vim/syntax/swift.vim | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/utils/vim/syntax/swift.vim b/utils/vim/syntax/swift.vim index 14dec4bfa5a37..7dd4b49aeee1d 100644 --- a/utils/vim/syntax/swift.vim +++ b/utils/vim/syntax/swift.vim @@ -17,8 +17,10 @@ endif syn keyword swiftKeyword \ break + \ case \ catch \ continue + \ default \ defer \ do \ else @@ -87,6 +89,8 @@ syn keyword swiftTypeDefinition skipwhite skipempty nextgroup=swiftTypeName \ class \ enum \ extension + \ operator + \ precedencegroup \ protocol \ struct From 2b5059c204f3e4e0f8500789121c24bc913407e1 Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Fri, 12 Jun 2020 10:46:19 -0700 Subject: [PATCH 27/50] vim: handle `Any` and `AnyObject` as core types --- utils/vim/syntax/swift.vim | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/utils/vim/syntax/swift.vim b/utils/vim/syntax/swift.vim index 7dd4b49aeee1d..ee8980fb3a319 100644 --- a/utils/vim/syntax/swift.vim +++ b/utils/vim/syntax/swift.vim @@ -39,6 +39,10 @@ syn keyword swiftKeyword syn match swiftMultiwordKeyword \ "indirect case" +syn keyword swiftCoreTypes + \ Any + \ AnyObject + syn keyword swiftImport skipwhite skipempty nextgroup=swiftImportModule \ import @@ -212,9 +216,9 @@ syn match swiftAttribute syn keyword swiftTodo MARK TODO FIXME contained -syn match swiftCastOp skipwhite skipempty nextgroup=swiftType +syn match swiftCastOp skipwhite skipempty nextgroup=swiftType,swiftCoreTypes \ "\" -syn match swiftCastOp skipwhite skipempty nextgroup=swiftType +syn match swiftCastOp skipwhite skipempty nextgroup=swiftType,swiftCoreTypes \ "\[!?]\?" syn match swiftNilOps @@ -227,6 +231,7 @@ hi def link swiftImport Include hi def link swiftImportModule Title hi def link swiftImportComponent Identifier hi def link swiftKeyword Statement +hi def link swiftCoreTypes Type hi def link swiftMultiwordKeyword Statement hi def link swiftTypeDefinition Define hi def link swiftMultiwordTypeDefinition Define From 20dbe3fb220570da839a8dd27de6f5ae8cfe98db Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Fri, 12 Jun 2020 10:47:09 -0700 Subject: [PATCH 28/50] vim: handle `column` and `dsohandle` identifiers --- utils/vim/syntax/swift.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/vim/syntax/swift.vim b/utils/vim/syntax/swift.vim index ee8980fb3a319..b3db3dc949e2d 100644 --- a/utils/vim/syntax/swift.vim +++ b/utils/vim/syntax/swift.vim @@ -205,7 +205,7 @@ syn match swiftDecimal contained \ /[0-9]\+/ syn match swiftPreproc - \ /#\(\\|\\|\\)/ + \ /#\(\\|\\|\\|\\|\\)/ syn match swiftPreproc \ /^\s*#\(\\|\\|\\|\\|\\|\\)/ syn region swiftPreprocFalse From 36dfd0d90b93bf71dd8eaaa4ce9a20ca61819970 Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Fri, 12 Jun 2020 11:35:59 -0700 Subject: [PATCH 29/50] build: remove unnecessary variable (NFC) --- tools/CMakeLists.txt | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index ede02f0068bb7..57c3596fe89d0 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -41,12 +41,6 @@ add_swift_tool_subdirectory(swift-demangle-fuzzer) add_swift_tool_subdirectory(swift-reflection-fuzzer) endif() -if(SWIFT_BUILD_STDLIB AND SWIFT_BUILD_SDK_OVERLAY) - set(BUILD_FOUNDATION TRUE) -else() - set(BUILD_FOUNDATION FALSE) -endif() - if(SWIFT_BUILD_SOURCEKIT) add_swift_tool_subdirectory(SourceKit) endif() From 04c8f0df4219c629f00be3307222d65601d7da59 Mon Sep 17 00:00:00 2001 From: Joe Groff Date: Thu, 11 Jun 2020 15:12:18 -0700 Subject: [PATCH 30/50] IRGen: Don't reify internal vtable entries that are marked overridden. Private and internal classes shouldn't have ABI constraints on their concrete vtable layout, so if methods don't have overrides in practice, we can elide their vtable entries. --- include/swift/SIL/SILModule.h | 2 +- include/swift/SIL/SILVTable.h | 14 ++-- lib/IRGen/ClassMetadataVisitor.h | 30 +++++++-- lib/IRGen/GenMeta.cpp | 70 +++++++++++++++++--- lib/IRGen/MetadataLayout.cpp | 4 +- lib/SIL/IR/SILModule.cpp | 6 +- lib/SIL/IR/SILPrinter.cpp | 7 +- lib/SIL/Parser/ParseSIL.cpp | 7 +- lib/SIL/Verifier/SILVerifier.cpp | 14 ++-- lib/SILGen/SILGenType.cpp | 14 ++-- lib/SILOptimizer/Transforms/PruneVTables.cpp | 16 +++-- lib/Serialization/DeserializeSIL.cpp | 10 +-- lib/Serialization/ModuleFormat.h | 2 +- lib/Serialization/SILFormat.h | 2 +- lib/Serialization/SerializeSIL.cpp | 6 +- test/IRGen/vtable_non_overridden.sil | 68 +++++++++++++++++++ test/SIL/Parser/basic.sil | 4 +- 17 files changed, 221 insertions(+), 55 deletions(-) create mode 100644 test/IRGen/vtable_non_overridden.sil diff --git a/include/swift/SIL/SILModule.h b/include/swift/SIL/SILModule.h index 4c97abd5751f2..a5c38959ad889 100644 --- a/include/swift/SIL/SILModule.h +++ b/include/swift/SIL/SILModule.h @@ -595,7 +595,7 @@ class SILModule { bool deserializeLazily=true); /// Look up the VTable mapped to the given ClassDecl. Returns null on failure. - SILVTable *lookUpVTable(const ClassDecl *C); + SILVTable *lookUpVTable(const ClassDecl *C, bool deserializeLazily = true); /// Attempt to lookup the function corresponding to \p Member in the class /// hierarchy of \p Class. diff --git a/include/swift/SIL/SILVTable.h b/include/swift/SIL/SILVTable.h index 405063e70cd01..cd9f9c0a87c4c 100644 --- a/include/swift/SIL/SILVTable.h +++ b/include/swift/SIL/SILVTable.h @@ -49,13 +49,12 @@ class SILVTableEntry { /// The function which implements the method for the class and the entry kind. llvm::PointerIntPair ImplAndKind; + bool IsNonOverridden; + public: enum Kind : uint8_t { /// The vtable entry is for a method defined directly in this class. Normal, - /// The vtable entry is for a method defined directly in this class, and is - /// never overridden by subclasses. - NormalNonOverridden, /// The vtable entry is inherited from the superclass. Inherited, /// The vtable entry is inherited from the superclass, and overridden @@ -67,14 +66,19 @@ class SILVTableEntry { SILVTableEntry() : ImplAndKind(nullptr, Kind::Normal) {} - SILVTableEntry(SILDeclRef Method, SILFunction *Implementation, Kind TheKind) - : Method(Method), ImplAndKind(Implementation, TheKind) {} + SILVTableEntry(SILDeclRef Method, SILFunction *Implementation, Kind TheKind, + bool NonOverridden) + : Method(Method), ImplAndKind(Implementation, TheKind), + IsNonOverridden(NonOverridden) {} SILDeclRef getMethod() const { return Method; } Kind getKind() const { return Kind(ImplAndKind.getInt()); } void setKind(Kind kind) { ImplAndKind.setInt(kind); } + bool isNonOverridden() const { return IsNonOverridden; } + void setNonOverridden(bool value) { IsNonOverridden = value; } + SILFunction *getImplementation() const { return ImplAndKind.getPointer(); } }; diff --git a/lib/IRGen/ClassMetadataVisitor.h b/lib/IRGen/ClassMetadataVisitor.h index a7453f8dad37c..168f7cc0eea64 100644 --- a/lib/IRGen/ClassMetadataVisitor.h +++ b/lib/IRGen/ClassMetadataVisitor.h @@ -21,6 +21,8 @@ #include "swift/AST/ASTContext.h" #include "swift/AST/SubstitutionMap.h" #include "swift/SIL/SILDeclRef.h" +#include "swift/SIL/SILModule.h" +#include "swift/SIL/SILVTable.h" #include "swift/SIL/SILVTableVisitor.h" #include "IRGen.h" #include "NominalMetadataVisitor.h" @@ -30,6 +32,15 @@ namespace irgen { class IRGenModule; +/// Returns true if the given SILVTable entry needs to be reified as a runtime +/// vtable entry. +/// +/// Methods that have no overrides, and no ABI constraints that require a +/// vtable to be present, can be left out of the runtime vtable for classes. +bool methodRequiresReifiedVTableEntry(IRGenModule &IGM, + const SILVTable *vtable, + SILDeclRef method); + /// A CRTP class for laying out class metadata. Note that this does /// *not* handle the metadata template stuff. template class ClassMetadataVisitor @@ -43,9 +54,13 @@ template class ClassMetadataVisitor /// The most-derived class. ClassDecl *const Target; + + /// SILVTable entry for the class. + const SILVTable *VTable; ClassMetadataVisitor(IRGenModule &IGM, ClassDecl *target) - : super(IGM), Target(target) {} + : super(IGM), Target(target), + VTable(IGM.getSILModule().lookUpVTable(target, /*deserialize*/ false)) {} public: void layout() { @@ -152,8 +167,15 @@ template class ClassMetadataVisitor // Add vtable entries. asImpl().addVTableEntries(theClass); } - -private: + + friend SILVTableVisitor; + void addMethod(SILDeclRef declRef) { + // Does this method require a reified runtime vtable entry? + if (methodRequiresReifiedVTableEntry(IGM, VTable, declRef)) { + asImpl().addReifiedVTableEntry(declRef); + } + } + void addFieldEntries(Decl *field) { if (auto var = dyn_cast(field)) { asImpl().addFieldOffset(var); @@ -194,7 +216,7 @@ class ClassMetadataScanner : public ClassMetadataVisitor { void addClassAddressPoint() { addInt32(); } void addClassCacheData() { addPointer(); addPointer(); } void addClassDataPointer() { addPointer(); } - void addMethod(SILDeclRef declRef) { + void addReifiedVTableEntry(SILDeclRef declRef) { addPointer(); } void addMethodOverride(SILDeclRef baseRef, SILDeclRef declRef) {} diff --git a/lib/IRGen/GenMeta.cpp b/lib/IRGen/GenMeta.cpp index 0487fe65f871c..827f5991da022 100644 --- a/lib/IRGen/GenMeta.cpp +++ b/lib/IRGen/GenMeta.cpp @@ -1437,7 +1437,13 @@ namespace { } void addMethod(SILDeclRef fn) { - VTableEntries.push_back(fn); + if (methodRequiresReifiedVTableEntry(IGM, VTable, fn)) { + VTableEntries.push_back(fn); + } else if (getType()->getEffectiveAccess() >= AccessLevel::Public) { + // Emit a stub method descriptor and lookup function for nonoverridden + // methods so that resilient code sequences can still use them. + emitNonoverriddenMethod(fn); + } } void addMethodOverride(SILDeclRef baseRef, SILDeclRef declRef) { @@ -1521,9 +1527,6 @@ namespace { } void addVTable() { - if (VTableEntries.empty()) - return; - LLVM_DEBUG( llvm::dbgs() << "VTable entries for " << getType()->getName() << ":\n"; for (auto entry : VTableEntries) { @@ -1533,6 +1536,9 @@ namespace { } ); + if (VTableEntries.empty()) + return; + // Only emit a method lookup function if the class is resilient // and has a non-empty vtable. if (IGM.hasResilientMetadata(getType(), ResilienceExpansion::Minimal)) @@ -1595,8 +1601,25 @@ namespace { IGM.emitDispatchThunk(fn); } } + + void emitNonoverriddenMethod(SILDeclRef fn) { + // TODO: Emit a freestanding method descriptor structure, and a method + // lookup function, to present the ABI of an overridable method even + // though the method has no real overrides currently. + } void addOverrideTable() { + LLVM_DEBUG( + llvm::dbgs() << "Override Table entries for " << getType()->getName() << ":\n"; + for (auto entry : OverrideTableEntries) { + llvm::dbgs() << " "; + entry.first.print(llvm::dbgs()); + llvm::dbgs() << " -> "; + entry.second.print(llvm::dbgs()); + llvm::dbgs() << '\n'; + } + ); + if (OverrideTableEntries.empty()) return; @@ -2702,12 +2725,12 @@ namespace { using super::asImpl; using super::IGM; using super::Target; + using super::VTable; ConstantStructBuilder &B; const ClassLayout &FieldLayout; const ClassMetadataLayout &MetadataLayout; - const SILVTable *VTable; Size AddressPoint; @@ -2717,8 +2740,7 @@ namespace { const ClassLayout &fieldLayout) : super(IGM, theClass), B(builder), FieldLayout(fieldLayout), - MetadataLayout(IGM.getClassMetadataLayout(theClass)), - VTable(IGM.getSILModule().lookUpVTable(theClass)) {} + MetadataLayout(IGM.getClassMetadataLayout(theClass)) {} public: SILType getLoweredType() { @@ -2854,7 +2876,7 @@ namespace { PointerAuthEntity::Special::HeapDestructor); } else { // In case the optimizer removed the function. See comment in - // addMethod(). + // addReifiedVTableEntry(). B.addNullPointer(IGM.FunctionPtrTy); } } @@ -2973,7 +2995,7 @@ namespace { B.add(data); } - void addMethod(SILDeclRef fn) { + void addReifiedVTableEntry(SILDeclRef fn) { // Find the vtable entry. assert(VTable && "no vtable?!"); auto entry = VTable->getEntry(IGM.getSILModule(), fn); @@ -5075,3 +5097,33 @@ void IRGenModule::emitOpaqueTypeDecl(OpaqueTypeDecl *D) { // Emit the opaque type descriptor. OpaqueTypeDescriptorBuilder(*this, D).emit(); } + +bool irgen::methodRequiresReifiedVTableEntry(IRGenModule &IGM, + const SILVTable *vtable, + SILDeclRef method) { + auto &M = IGM.getSILModule(); + auto entry = vtable->getEntry(IGM.getSILModule(), method); + if (!entry) { + return true; + } + + // We may be able to elide the vtable entry, ABI permitting, if it's not + // overridden. + if (!entry->isNonOverridden()) { + return true; + } + + // Does the ABI require a vtable entry to exist? If the class is public, + // and it's either marked fragile or part of a non-resilient module, then + // other modules will directly address vtable offsets and we can't remove + // vtable entries. + if (vtable->getClass()->getEffectiveAccess() >= AccessLevel::Public) { + // TODO: Check whether we use a resilient ABI to access this + // class's methods. We can drop unnecessary vtable entries if we do; + // otherwise fixed vtable offsets are part of the ABI. + return true; + } + + // Otherwise, we can leave this method out of the runtime vtable. + return false; +} diff --git a/lib/IRGen/MetadataLayout.cpp b/lib/IRGen/MetadataLayout.cpp index 274f3e6c616a4..f8cbaf4b57948 100644 --- a/lib/IRGen/MetadataLayout.cpp +++ b/lib/IRGen/MetadataLayout.cpp @@ -330,12 +330,12 @@ ClassMetadataLayout::ClassMetadataLayout(IRGenModule &IGM, ClassDecl *decl) super::addGenericArgument(requirement, forClass); } - void addMethod(SILDeclRef fn) { + void addReifiedVTableEntry(SILDeclRef fn) { if (fn.getDecl()->getDeclContext() == Target) { ++Layout.NumImmediateMembers; Layout.MethodInfos.try_emplace(fn, getNextOffset()); } - super::addMethod(fn); + super::addReifiedVTableEntry(fn); } void noteStartOfFieldOffsets(ClassDecl *forClass) { diff --git a/lib/SIL/IR/SILModule.cpp b/lib/SIL/IR/SILModule.cpp index 1c941a1076375..68d8f2a54dd40 100644 --- a/lib/SIL/IR/SILModule.cpp +++ b/lib/SIL/IR/SILModule.cpp @@ -476,7 +476,8 @@ void SILModule::eraseGlobalVariable(SILGlobalVariable *G) { getSILGlobalList().erase(G); } -SILVTable *SILModule::lookUpVTable(const ClassDecl *C) { +SILVTable *SILModule::lookUpVTable(const ClassDecl *C, + bool deserializeLazily) { if (!C) return nullptr; @@ -485,6 +486,9 @@ SILVTable *SILModule::lookUpVTable(const ClassDecl *C) { if (R != VTableMap.end()) return R->second; + if (!deserializeLazily) + return nullptr; + // If that fails, try to deserialize it. If that fails, return nullptr. SILVTable *Vtbl = getSILLoader()->lookupVTable(C); if (!Vtbl) diff --git a/lib/SIL/IR/SILPrinter.cpp b/lib/SIL/IR/SILPrinter.cpp index a4fe67f32bc65..a0613879a627c 100644 --- a/lib/SIL/IR/SILPrinter.cpp +++ b/lib/SIL/IR/SILPrinter.cpp @@ -3131,9 +3131,6 @@ void SILVTable::print(llvm::raw_ostream &OS, bool Verbose) const { switch (entry.getKind()) { case SILVTable::Entry::Kind::Normal: break; - case SILVTable::Entry::Kind::NormalNonOverridden: - OS << " [nonoverridden]"; - break; case SILVTable::Entry::Kind::Inherited: OS << " [inherited]"; break; @@ -3141,6 +3138,10 @@ void SILVTable::print(llvm::raw_ostream &OS, bool Verbose) const { OS << " [override]"; break; } + if (entry.isNonOverridden()) { + OS << " [nonoverridden]"; + } + OS << "\t// " << demangleSymbol(entry.getImplementation()->getName()); OS << "\n"; } diff --git a/lib/SIL/Parser/ParseSIL.cpp b/lib/SIL/Parser/ParseSIL.cpp index 90603b27bfbf3..709e24dc2ba76 100644 --- a/lib/SIL/Parser/ParseSIL.cpp +++ b/lib/SIL/Parser/ParseSIL.cpp @@ -6083,7 +6083,8 @@ bool SILParserState::parseSILVTable(Parser &P) { } auto Kind = SILVTable::Entry::Kind::Normal; - if (P.Tok.is(tok::l_square)) { + bool NonOverridden = false; + while (P.Tok.is(tok::l_square)) { P.consumeToken(tok::l_square); if (P.Tok.isNot(tok::identifier)) { P.diagnose(P.Tok.getLoc(), diag::sil_vtable_bad_entry_kind); @@ -6098,7 +6099,7 @@ bool SILParserState::parseSILVTable(Parser &P) { Kind = SILVTable::Entry::Kind::Inherited; } else if (P.Tok.getText() == "nonoverridden") { P.consumeToken(); - Kind = SILVTable::Entry::Kind::NormalNonOverridden; + NonOverridden = true; } else { P.diagnose(P.Tok.getLoc(), diag::sil_vtable_bad_entry_kind); return true; @@ -6108,7 +6109,7 @@ bool SILParserState::parseSILVTable(Parser &P) { return true; } - vtableEntries.emplace_back(Ref, Func, Kind); + vtableEntries.emplace_back(Ref, Func, Kind, NonOverridden); } while (P.Tok.isNot(tok::r_brace) && P.Tok.isNot(tok::eof)); } diff --git a/lib/SIL/Verifier/SILVerifier.cpp b/lib/SIL/Verifier/SILVerifier.cpp index 24e601367aa43..84e74fb9db4ee 100644 --- a/lib/SIL/Verifier/SILVerifier.cpp +++ b/lib/SIL/Verifier/SILVerifier.cpp @@ -5425,7 +5425,6 @@ void SILVTable::verify(const SILModule &M) const { bool validKind; switch (entry.getKind()) { case Entry::Normal: - case Entry::NormalNonOverridden: validKind = true; break; @@ -5450,21 +5449,26 @@ void SILVTable::verify(const SILModule &M) const { switch (entry.getKind()) { case Entry::Normal: - case Entry::NormalNonOverridden: assert(!superEntry && "non-root vtable entry must be inherited or override"); break; case Entry::Inherited: + if (!superEntry) + break; + + assert(entry.isNonOverridden() == superEntry->isNonOverridden() + && "inherited vtable entry must share overridden-ness of superclass entry"); break; case Entry::Override: + assert(!entry.isNonOverridden() + && "override entry can't claim to be nonoverridden"); if (!superEntry) break; // The superclass entry must not prohibit overrides. - assert( - superEntry->getKind() != Entry::NormalNonOverridden && - "vtable entry overrides an entry that claims to have no overrides"); + assert(!superEntry->isNonOverridden() + && "vtable entry overrides an entry that claims to have no overrides"); // TODO: Check the root vtable entry for the method too. break; } diff --git a/lib/SILGen/SILGenType.cpp b/lib/SILGen/SILGenType.cpp index b4356c89bb066..83f2de20c78f3 100644 --- a/lib/SILGen/SILGenType.cpp +++ b/lib/SILGen/SILGenType.cpp @@ -104,7 +104,7 @@ SILGenModule::emitVTableMethod(ClassDecl *theClass, // As a fast path, if there is no override, definitely no thunk is necessary. if (derived == base) - return SILVTable::Entry(base, implFn, implKind); + return SILVTable::Entry(base, implFn, implKind, false); // If the base method is less visible than the derived method, we need // a thunk. @@ -151,7 +151,7 @@ SILGenModule::emitVTableMethod(ClassDecl *theClass, if (doesNotHaveGenericRequirementDifference && !baseLessVisibleThanDerived && compatibleCallingConvention) - return SILVTable::Entry(base, implFn, implKind); + return SILVTable::Entry(base, implFn, implKind, false); // Generate the thunk name. std::string name; @@ -182,7 +182,7 @@ SILGenModule::emitVTableMethod(ClassDecl *theClass, // If we already emitted this thunk, reuse it. if (auto existingThunk = M.lookUpFunction(name)) - return SILVTable::Entry(base, existingThunk, implKind); + return SILVTable::Entry(base, existingThunk, implKind, false); GenericEnvironment *genericEnv = nullptr; if (auto genericSig = overrideInfo.FormalType.getOptGenericSignature()) @@ -207,7 +207,7 @@ SILGenModule::emitVTableMethod(ClassDecl *theClass, baseLessVisibleThanDerived); emitLazyConformancesForFunction(thunk); - return SILVTable::Entry(base, thunk, implKind); + return SILVTable::Entry(base, thunk, implKind, false); } bool SILGenModule::requiresObjCMethodEntryPoint(FuncDecl *method) { @@ -292,14 +292,16 @@ class SILGenVTable : public SILVTableVisitor { SILDeclRef dtorRef(dtor, SILDeclRef::Kind::Deallocator); auto *dtorFn = SGM.getFunction(dtorRef, NotForDefinition); vtableEntries.emplace_back(dtorRef, dtorFn, - SILVTable::Entry::Kind::Normal); + SILVTable::Entry::Kind::Normal, + false); } if (SGM.requiresIVarDestroyer(theClass)) { SILDeclRef dtorRef(theClass, SILDeclRef::Kind::IVarDestroyer); auto *dtorFn = SGM.getFunction(dtorRef, NotForDefinition); vtableEntries.emplace_back(dtorRef, dtorFn, - SILVTable::Entry::Kind::Normal); + SILVTable::Entry::Kind::Normal, + false); } IsSerialized_t serialized = IsNotSerialized; diff --git a/lib/SILOptimizer/Transforms/PruneVTables.cpp b/lib/SILOptimizer/Transforms/PruneVTables.cpp index 6651390abc252..c918e88542e69 100644 --- a/lib/SILOptimizer/Transforms/PruneVTables.cpp +++ b/lib/SILOptimizer/Transforms/PruneVTables.cpp @@ -27,9 +27,18 @@ class PruneVTables : public SILModuleTransform { void runOnVTable(SILModule *M, SILVTable *vtable) { for (auto &entry : vtable->getMutableEntries()) { - // We don't need to worry about entries that are inherited, overridden, + + // We don't need to worry about entries that are overridden, // or have already been found to have no overrides. - if (entry.getKind() != SILVTable::Entry::Normal) { + if (entry.isNonOverridden()) + continue; + + switch (entry.getKind()) { + case SILVTable::Entry::Normal: + case SILVTable::Entry::Inherited: + break; + + case SILVTable::Entry::Override: continue; } @@ -52,8 +61,7 @@ class PruneVTables : public SILModuleTransform { if (methodDecl->isOverridden()) continue; } - - entry.setKind(SILVTable::Entry::NormalNonOverridden); + entry.setNonOverridden(true); } } diff --git a/lib/Serialization/DeserializeSIL.cpp b/lib/Serialization/DeserializeSIL.cpp index 3d89dad463117..7e9dfeb71a698 100644 --- a/lib/Serialization/DeserializeSIL.cpp +++ b/lib/Serialization/DeserializeSIL.cpp @@ -79,8 +79,6 @@ static Optional fromStableVTableEntryKind(unsigned value) { switch (value) { case SIL_VTABLE_ENTRY_NORMAL: return SILVTable::Entry::Kind::Normal; - case SIL_VTABLE_ENTRY_NORMAL_NON_OVERRIDDEN: - return SILVTable::Entry::Kind::NormalNonOverridden; case SIL_VTABLE_ENTRY_INHERITED: return SILVTable::Entry::Kind::Inherited; case SIL_VTABLE_ENTRY_OVERRIDE: return SILVTable::Entry::Kind::Override; default: return None; @@ -3034,8 +3032,10 @@ SILVTable *SILDeserializer::readVTable(DeclID VId) { "Content of Vtable should be in SIL_VTABLE_ENTRY."); ArrayRef ListOfValues; DeclID NameID; - unsigned RawEntryKind; - VTableEntryLayout::readRecord(scratch, NameID, RawEntryKind, ListOfValues); + unsigned RawEntryKind, IsNonOverridden; + VTableEntryLayout::readRecord(scratch, NameID, + RawEntryKind, IsNonOverridden, + ListOfValues); auto EntryKind = fromStableVTableEntryKind(RawEntryKind); @@ -3043,7 +3043,7 @@ SILVTable *SILDeserializer::readVTable(DeclID VId) { if (Func) { unsigned NextValueIndex = 0; vtableEntries.emplace_back(getSILDeclRef(MF, ListOfValues, NextValueIndex), - Func, EntryKind.getValue()); + Func, EntryKind.getValue(), (bool)IsNonOverridden); } // Fetch the next record. diff --git a/lib/Serialization/ModuleFormat.h b/lib/Serialization/ModuleFormat.h index cef301bc538ca..065150c5d4d3b 100644 --- a/lib/Serialization/ModuleFormat.h +++ b/lib/Serialization/ModuleFormat.h @@ -55,7 +55,7 @@ const uint16_t SWIFTMODULE_VERSION_MAJOR = 0; /// describe what change you made. The content of this comment isn't important; /// it just ensures a conflict if two people change the module format. /// Don't worry about adhering to the 80-column limit for this line. -const uint16_t SWIFTMODULE_VERSION_MINOR = 559; // Serialization of -implicit-dynamic +const uint16_t SWIFTMODULE_VERSION_MINOR = 560; // SILVTable flag for non-overridden entries /// A standard hash seed used for all string hashes in a serialized module. /// diff --git a/lib/Serialization/SILFormat.h b/lib/Serialization/SILFormat.h index 5cee308de8e30..ec16f5e92b975 100644 --- a/lib/Serialization/SILFormat.h +++ b/lib/Serialization/SILFormat.h @@ -51,7 +51,6 @@ using SILLinkageField = BCFixed<4>; enum SILVTableEntryKindEncoding : uint8_t { SIL_VTABLE_ENTRY_NORMAL, - SIL_VTABLE_ENTRY_NORMAL_NON_OVERRIDDEN, SIL_VTABLE_ENTRY_INHERITED, SIL_VTABLE_ENTRY_OVERRIDE, }; @@ -183,6 +182,7 @@ namespace sil_block { SIL_VTABLE_ENTRY, DeclIDField, // SILFunction name SILVTableEntryKindField, // Kind + BCFixed<1>, // NonOverridden BCArray // SILDeclRef >; diff --git a/lib/Serialization/SerializeSIL.cpp b/lib/Serialization/SerializeSIL.cpp index ce262f5165ef5..aad7fa2b7d3c8 100644 --- a/lib/Serialization/SerializeSIL.cpp +++ b/lib/Serialization/SerializeSIL.cpp @@ -73,8 +73,6 @@ static unsigned toStableSILLinkage(SILLinkage linkage) { static unsigned toStableVTableEntryKind(SILVTable::Entry::Kind kind) { switch (kind) { case SILVTable::Entry::Kind::Normal: return SIL_VTABLE_ENTRY_NORMAL; - case SILVTable::Entry::Kind::NormalNonOverridden: - return SIL_VTABLE_ENTRY_NORMAL_NON_OVERRIDDEN; case SILVTable::Entry::Kind::Inherited: return SIL_VTABLE_ENTRY_INHERITED; case SILVTable::Entry::Kind::Override: return SIL_VTABLE_ENTRY_OVERRIDE; } @@ -2390,7 +2388,9 @@ void SILSerializer::writeSILVTable(const SILVTable &vt) { Out, ScratchRecord, SILAbbrCodes[VTableEntryLayout::Code], // SILFunction name S.addUniquedStringRef(entry.getImplementation()->getName()), - toStableVTableEntryKind(entry.getKind()), ListOfValues); + toStableVTableEntryKind(entry.getKind()), + entry.isNonOverridden(), + ListOfValues); } } diff --git a/test/IRGen/vtable_non_overridden.sil b/test/IRGen/vtable_non_overridden.sil new file mode 100644 index 0000000000000..003f61ab988c5 --- /dev/null +++ b/test/IRGen/vtable_non_overridden.sil @@ -0,0 +1,68 @@ +// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s + +class InternalA { + init() + func foo() + func bar() + func bas() +} + +sil @InternalA_foo : $@convention(method) (@guaranteed InternalA) -> () +sil @InternalA_bar : $@convention(method) (@guaranteed InternalA) -> () +sil @InternalA_bas : $@convention(method) (@guaranteed InternalA) -> () +sil @InternalA_init : $@convention(method) (@thick InternalA.Type) -> @owned InternalA +sil @InternalA_dealloc : $@convention(method) (@owned InternalA) -> () + +sil_vtable InternalA { + #InternalA.deinit!deallocator : @InternalA_dealloc + #InternalA.init!allocator : @InternalA_init + #InternalA.foo : @InternalA_foo [nonoverridden] + #InternalA.bar : @InternalA_bar + #InternalA.bas : @InternalA_bas [nonoverridden] +} + +// -- only overridden entries in internal method descriptor table +// CHECK-LABEL: @"$s21vtable_non_overridden9InternalACMn" = +// CHECK-SAME: i32 2, %swift.method_descriptor +// CHECK-SAME: @InternalA_init +// CHECK-NOT: @InternalA_foo +// CHECK-SAME: @InternalA_bar +// CHECK-NOT: @InternalA_bas + +// -- only overridden entries in internal vtable +// CHECK-LABEL: @"$s21vtable_non_overridden9InternalACMf" = +// CHECK-SAME: @InternalA_init +// CHECK-NOT: @InternalA_foo +// CHECK-SAME: @InternalA_bar +// CHECK-NOT: @InternalA_bas + +sil @InternalB_bar : $@convention(method) (@guaranteed InternalB) -> () +sil @InternalB_init : $@convention(method) (@thick InternalB.Type) -> @owned InternalB +sil @InternalB_dealloc : $@convention(method) (@owned InternalB) -> () + +class InternalB: InternalA { + override func bar() +} + +sil_vtable InternalB { + #InternalB.deinit!deallocator : @InternalB_dealloc + #InternalA.init!allocator : @InternalB_init [override] + #InternalA.foo : @InternalA_foo [inherited] [nonoverridden] + #InternalA.bar : @InternalB_bar [override] + #InternalA.bas : @InternalA_bas [inherited] [nonoverridden] +} + +// -- only overridden entries in internal method descriptor table +// CHECK-LABEL: @"$s21vtable_non_overridden9InternalBCMn" = +// CHECK-SAME: i32 2, %swift.method_override_descriptor +// CHECK-NOT: @InternalA_foo +// CHECK-SAME: @InternalB_bar +// CHECK-NOT: @InternalA_bas +// CHECK-SAME: @InternalB_init + +// -- only overridden entries in internal vtable +// CHECK-LABEL: @"$s21vtable_non_overridden9InternalBCMf" = +// CHECK-SAME: @InternalB_init +// CHECK-NOT: @InternalA_foo +// CHECK-SAME: @InternalB_bar +// CHECK-NOT: @InternalA_bas diff --git a/test/SIL/Parser/basic.sil b/test/SIL/Parser/basic.sil index b144a203448b2..b74b3ec0a262d 100644 --- a/test/SIL/Parser/basic.sil +++ b/test/SIL/Parser/basic.sil @@ -1700,10 +1700,10 @@ sil_vtable Foo { } // CHECK-LABEL: sil_vtable Foo2 { -// CHECK: #Foo.subscript!getter: {{.*}} : @Foo_subscript_getter [inherited] +// CHECK: #Foo.subscript!getter: {{.*}} : @Foo_subscript_getter [inherited] [nonoverridden] // CHECK: #Foo.subscript!setter: {{.*}} : @Foo_subscript_setter [override] // CHECK: } sil_vtable Foo2 { - #Foo.subscript!getter: @Foo_subscript_getter [inherited] + #Foo.subscript!getter: @Foo_subscript_getter [inherited] [nonoverridden] #Foo.subscript!setter: @Foo_subscript_setter [override] } From b2e8a602f201c15a84ec5903fad8b441ff90ba21 Mon Sep 17 00:00:00 2001 From: Luciano Almeida Date: Fri, 12 Jun 2020 16:08:29 -0300 Subject: [PATCH 31/50] [TypeCheckType] Lift malformed type check for fnType in resolveASTFunctionType --- lib/Sema/TypeCheckType.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/Sema/TypeCheckType.cpp b/lib/Sema/TypeCheckType.cpp index fc03b2ce4c8b5..5b67d2fcf4042 100644 --- a/lib/Sema/TypeCheckType.cpp +++ b/lib/Sema/TypeCheckType.cpp @@ -2700,13 +2700,16 @@ Type TypeResolver::resolveASTFunctionType( } auto fnTy = FunctionType::get(params, outputTy, extInfo); + + if (fnTy->hasError()) + return fnTy; + // If the type is a block or C function pointer, it must be representable in // ObjC. switch (representation) { case AnyFunctionType::Representation::Block: case AnyFunctionType::Representation::CFunctionPointer: - if (!fnTy->hasError() && - !fnTy->isRepresentableIn(ForeignLanguage::ObjectiveC, DC)) { + if (!fnTy->isRepresentableIn(ForeignLanguage::ObjectiveC, DC)) { StringRef strName = (representation == AnyFunctionType::Representation::Block) ? "block" From 71d2c37828598e0e2af50f594cf2a2116b511d58 Mon Sep 17 00:00:00 2001 From: Zoe Carver Date: Fri, 12 Jun 2020 12:30:33 -0700 Subject: [PATCH 32/50] [cxx-interop] Add support for percent, ampersand, and pipe operators. (#32332) Adds support for three more basic infix operators: `%`, `&`, and `|`. Co-authored-by: Michael Forster --- lib/ClangImporter/ImportName.cpp | 3 +++ .../Cxx/operators/Inputs/non-member-inline.h | 12 +++++++++ .../non-member-inline-module-interface.swift | 3 +++ .../non-member-inline-typechecker.swift | 3 +++ .../Cxx/operators/non-member-inline.swift | 27 +++++++++++++++++++ 5 files changed, 48 insertions(+) diff --git a/lib/ClangImporter/ImportName.cpp b/lib/ClangImporter/ImportName.cpp index 23d49a3be21ea..964f8195a40a4 100644 --- a/lib/ClangImporter/ImportName.cpp +++ b/lib/ClangImporter/ImportName.cpp @@ -1423,6 +1423,9 @@ ImportedName NameImporter::importNameImpl(const clang::NamedDecl *D, case clang::OverloadedOperatorKind::OO_Minus: case clang::OverloadedOperatorKind::OO_Star: case clang::OverloadedOperatorKind::OO_Slash: + case clang::OverloadedOperatorKind::OO_Percent: + case clang::OverloadedOperatorKind::OO_Amp: + case clang::OverloadedOperatorKind::OO_Pipe: case clang::OverloadedOperatorKind::OO_LessLess: case clang::OverloadedOperatorKind::OO_GreaterGreater: case clang::OverloadedOperatorKind::OO_AmpAmp: diff --git a/test/Interop/Cxx/operators/Inputs/non-member-inline.h b/test/Interop/Cxx/operators/Inputs/non-member-inline.h index 7c4f28dfcd703..7704289b1ab1e 100644 --- a/test/Interop/Cxx/operators/Inputs/non-member-inline.h +++ b/test/Interop/Cxx/operators/Inputs/non-member-inline.h @@ -21,6 +21,18 @@ inline IntBox operator/(IntBox lhs, IntBox rhs) { return IntBox{.value = lhs.value / rhs.value}; } +inline IntBox operator%(IntBox lhs, IntBox rhs) { + return IntBox{.value = lhs.value % rhs.value}; +} + +inline IntBox operator&(IntBox lhs, IntBox rhs) { + return IntBox{.value = lhs.value & rhs.value}; +} + +inline IntBox operator|(IntBox lhs, IntBox rhs) { + return IntBox{.value = lhs.value | rhs.value}; +} + inline IntBox operator<<(IntBox lhs, IntBox rhs) { return IntBox{.value = lhs.value << rhs.value}; } diff --git a/test/Interop/Cxx/operators/non-member-inline-module-interface.swift b/test/Interop/Cxx/operators/non-member-inline-module-interface.swift index b056312cd4e26..36970d2fd2ddf 100644 --- a/test/Interop/Cxx/operators/non-member-inline-module-interface.swift +++ b/test/Interop/Cxx/operators/non-member-inline-module-interface.swift @@ -4,6 +4,9 @@ // CHECK-NEXT: func - (lhs: IntBox, rhs: IntBox) -> IntBox // CHECK-NEXT: func * (lhs: IntBox, rhs: IntBox) -> IntBox // CHECK-NEXT: func / (lhs: IntBox, rhs: IntBox) -> IntBox +// CHECK-NEXT: func % (lhs: IntBox, rhs: IntBox) -> IntBox +// CHECK-NEXT: func & (lhs: IntBox, rhs: IntBox) -> IntBox +// CHECK-NEXT: func | (lhs: IntBox, rhs: IntBox) -> IntBox // CHECK-NEXT: func << (lhs: IntBox, rhs: IntBox) -> IntBox // CHECK-NEXT: func >> (lhs: IntBox, rhs: IntBox) -> IntBox diff --git a/test/Interop/Cxx/operators/non-member-inline-typechecker.swift b/test/Interop/Cxx/operators/non-member-inline-typechecker.swift index 92a09901517be..ca4585b5a097a 100644 --- a/test/Interop/Cxx/operators/non-member-inline-typechecker.swift +++ b/test/Interop/Cxx/operators/non-member-inline-typechecker.swift @@ -9,6 +9,9 @@ let resultPlus = lhs + rhs let resultMinus = lhs - rhs let resultStar = lhs * rhs let resultSlash = lhs / rhs +let resultPercent = lhs % rhs +let resultAmp = lhs & rhs +let resultPipe = lhs | rhs let resultLessLess = lhs << rhs let resultGreaterGreater = lhs >> rhs diff --git a/test/Interop/Cxx/operators/non-member-inline.swift b/test/Interop/Cxx/operators/non-member-inline.swift index c383c165a980f..8d23461d9cd06 100644 --- a/test/Interop/Cxx/operators/non-member-inline.swift +++ b/test/Interop/Cxx/operators/non-member-inline.swift @@ -43,6 +43,33 @@ OperatorsTestSuite.test("slash (/)") { expectEqual(1, result.value) } +OperatorsTestSuite.test("percent") { + let lhs = IntBox(value: 11) + let rhs = IntBox(value: 2) + + let result = lhs % rhs + + expectEqual(1, result.value) +} + +OperatorsTestSuite.test("amp") { + let lhs = IntBox(value: 6) + let rhs = IntBox(value: 5) + + let result = lhs & rhs + + expectEqual(4, result.value) +} + +OperatorsTestSuite.test("pipe") { + let lhs = IntBox(value: 6) + let rhs = IntBox(value: 5) + + let result = lhs | rhs + + expectEqual(7, result.value) +} + OperatorsTestSuite.test("less less (<<)") { let lhs = IntBox(value: 2) let rhs = IntBox(value: 4) From 0d57f3bf799e42523897dfedb82aa64888a349e0 Mon Sep 17 00:00:00 2001 From: Dan Zheng Date: Fri, 12 Jun 2020 13:44:01 -0700 Subject: [PATCH 33/50] [ParseSIL] NFC: fix SILDeclRef grammar comment. (#32347) --- lib/SIL/Parser/ParseSIL.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/SIL/Parser/ParseSIL.cpp b/lib/SIL/Parser/ParseSIL.cpp index 90603b27bfbf3..2475a2b70c9a4 100644 --- a/lib/SIL/Parser/ParseSIL.cpp +++ b/lib/SIL/Parser/ParseSIL.cpp @@ -1340,6 +1340,7 @@ static Optional getAccessorKind(StringRef ident) { /// sil-decl-subref ::= '!' sil-decl-subref-part ('.' sil-decl-lang)? /// ('.' sil-decl-autodiff)? /// sil-decl-subref ::= '!' sil-decl-lang +/// sil-decl-subref ::= '!' sil-decl-autodiff /// sil-decl-subref-part ::= 'getter' /// sil-decl-subref-part ::= 'setter' /// sil-decl-subref-part ::= 'allocator' From 5ec7cb7b689439c556564825d0d1f98361b6c52a Mon Sep 17 00:00:00 2001 From: Michael Gottesman Date: Fri, 12 Jun 2020 14:13:59 -0700 Subject: [PATCH 34/50] [build-script] llvm-dsymutil's component is dsymutil. --- utils/build_swift/build_swift/defaults.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/build_swift/build_swift/defaults.py b/utils/build_swift/build_swift/defaults.py index c864deea795f3..86beac7bb44bb 100644 --- a/utils/build_swift/build_swift/defaults.py +++ b/utils/build_swift/build_swift/defaults.py @@ -121,7 +121,7 @@ def llvm_install_components(): components = ['llvm-cov', 'llvm-profdata', 'IndexStore', 'clang', 'clang-resource-headers', 'compiler-rt', 'clangd'] if os.sys.platform == 'darwin': - components.extend(['llvm-dsymutil']) + components.extend(['dsymutil']) else: components.extend(['lld']) return ';'.join(components) From 2efde2507d67ccc9879bf3d1ebf9c0603f1f9a59 Mon Sep 17 00:00:00 2001 From: Nate Chandler Date: Fri, 12 Jun 2020 17:10:25 -0700 Subject: [PATCH 35/50] [Gardening] Ignored Package.resolved for swift-inspect. When running build-script with --swift-inspect, the Package.resolved file is created in tools/swift-inspect. Ignore it. --- tools/swift-inspect/.gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 tools/swift-inspect/.gitignore diff --git a/tools/swift-inspect/.gitignore b/tools/swift-inspect/.gitignore new file mode 100644 index 0000000000000..f4096fee41368 --- /dev/null +++ b/tools/swift-inspect/.gitignore @@ -0,0 +1 @@ +Package.resolved From f20d5676339f6e5c5f8595b19ed5cd9c97654119 Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Fri, 12 Jun 2020 18:01:24 -0700 Subject: [PATCH 36/50] Fix the hardcoded Swift AST section / segment name for Mach-O to match the one specified in LLVM's Mach-O parser. Otherwise LLDB could not possibly find it! This name is used by the swift -modulewrap subcommand, which is currently unused on Darwin, and primarily intended for use under Linux. However, it may be useful to better support static archives (.a) files with Swift debug info in the future. To fully support this, dsymutil and LLDB need to know to look for Swift AST sections in Mach-O objects other than .dSYM bundled. Implementation note: It would be nice to get the section name out of libObject, but with the current architecture this needs a major refactoring that didn't seem justified, given that there is an end-to-end test to prevent such a mishap in the future. --- include/swift/Basic/Dwarf.h | 4 ++-- lib/IRGen/IRGen.cpp | 4 ++++ test/DebugInfo/ASTSection-single.swift | 14 ++++++++++++++ test/DebugInfo/ASTSection_linker.swift | 2 +- 4 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 test/DebugInfo/ASTSection-single.swift diff --git a/include/swift/Basic/Dwarf.h b/include/swift/Basic/Dwarf.h index 16e06123f5470..2c6f12dbc7789 100644 --- a/include/swift/Basic/Dwarf.h +++ b/include/swift/Basic/Dwarf.h @@ -23,8 +23,8 @@ namespace swift { /// The DWARF version emitted by the Swift compiler. const unsigned DWARFVersion = 4; - static const char MachOASTSegmentName[] = "__SWIFT"; - static const char MachOASTSectionName[] = "__ast"; + static const char MachOASTSegmentName[] = "__DWARF"; + static const char MachOASTSectionName[] = "__swift_ast"; static const char ELFASTSectionName[] = ".swift_ast"; static const char COFFASTSectionName[] = "swiftast"; static const char WasmASTSectionName[] = ".swift_ast"; diff --git a/lib/IRGen/IRGen.cpp b/lib/IRGen/IRGen.cpp index 21a400c8f3213..ca88f2efaccff 100644 --- a/lib/IRGen/IRGen.cpp +++ b/lib/IRGen/IRGen.cpp @@ -1364,6 +1364,10 @@ swift::createSwiftModuleObjectFile(SILModule &SILMod, StringRef Buffer, assert(!Ctx.hadError()); IRGenOptions Opts; + // This tool doesn't pass the necessary runtime library path to + // TypeConverter, because this feature isn't needed. + Opts.DisableLegacyTypeInfo = true; + Opts.OutputKind = IRGenOutputKind::ObjectFile; IRGenerator irgen(Opts, SILMod); diff --git a/test/DebugInfo/ASTSection-single.swift b/test/DebugInfo/ASTSection-single.swift new file mode 100644 index 0000000000000..95f1f05578b92 --- /dev/null +++ b/test/DebugInfo/ASTSection-single.swift @@ -0,0 +1,14 @@ +// REQUIRES: executable_test +// REQUIRES: swift_tools_extra + +// Test that a module-wrapped Swift AST section can be parsed. + +// RUN: %empty-directory(%t) + +// RUN: echo "public let a0 = 0" >%t/a0.swift +// RUN: %target-build-swift %t/a0.swift -emit-module -emit-module-path %t/a0.swiftmodule +// RUN: %target-swift-modulewrap %t/a0.swiftmodule -o %t/a0-mod.o + +// RUN: %lldb-moduleimport-test -verbose %t/a0-mod.o | %FileCheck %s +// CHECK: Importing a0... ok! + diff --git a/test/DebugInfo/ASTSection_linker.swift b/test/DebugInfo/ASTSection_linker.swift index 7fbf987b8ad0f..bf49622056913 100644 --- a/test/DebugInfo/ASTSection_linker.swift +++ b/test/DebugInfo/ASTSection_linker.swift @@ -6,7 +6,7 @@ // RUN: %swift-ide-test -test-CompilerInvocation-from-module -source-filename=%t/ASTSection.swiftmodule // Test the inline section mechanism. -// RUN: %target-ld %t/ASTSection.o -sectcreate __SWIFT __ast %t/ASTSection.swiftmodule -o %t/ASTSection.dylib -dylib -lSystem -lobjc +// RUN: %target-ld %t/ASTSection.o -sectcreate __DWARF __swift_ast %t/ASTSection.swiftmodule -o %t/ASTSection.dylib -dylib -lSystem -lobjc // RUN: %lldb-moduleimport-test -verbose %t/ASTSection.dylib | %FileCheck %s // Test the symbol table entry. From c8ba43744401f32dafbc960a7636b3e671875801 Mon Sep 17 00:00:00 2001 From: 3405691582 Date: Fri, 20 Mar 2020 20:03:45 -0400 Subject: [PATCH 37/50] [test] Handle architecture aliasing for OpenBSD. Swift calls the architecture x86_64, OpenBSD calls it amd64. If we use run_cpu in lit.cfg as-is, then we may need to duplicate lines in each test for 'x86_64' and 'amd64', which puts a maintenance burden on unit test developers to ensure they are duplicating changes to each line. Instead, alias 'amd64' to 'x86_64' for `run_cpu`, but keep the platform module path referring to 'amd64', in order to distinguish the target architecture name and the Swift architecture name. This is particularly relevant for the %target-.*-name pseudovariables used, which should reference the Swift architecture names. However, some unit tests are directly referencing %target-cpu directly, which would break the aliasing. This is done only for swiftinterface files, so a new substitution is defined in lit.cfg for these variables, and the affected unit test cases are migrated. --- .../ModuleCache/prebuilt-module-cache-archs.swift | 2 +- .../ModuleCache/prebuilt-module-cache-unusable.swift | 4 ++-- .../prefer-local-module-to-sdk-framework.swift | 6 +++--- .../default-prebuilt-module-location.swift | 2 +- .../swift_build_sdk_interfaces/check-only-mode.swift | 6 +++--- .../compiler-uses-prebuilt.swift | 8 ++++---- .../track-system-dependencies.swift | 2 +- test/Serialization/load-target-fallback.swift | 8 ++++---- test/lit.cfg | 8 +++++++- 9 files changed, 26 insertions(+), 20 deletions(-) diff --git a/test/ModuleInterface/ModuleCache/prebuilt-module-cache-archs.swift b/test/ModuleInterface/ModuleCache/prebuilt-module-cache-archs.swift index 13523cf92440d..dc5c58f085ee1 100644 --- a/test/ModuleInterface/ModuleCache/prebuilt-module-cache-archs.swift +++ b/test/ModuleInterface/ModuleCache/prebuilt-module-cache-archs.swift @@ -1,6 +1,6 @@ // RUN: %empty-directory(%t) // RUN: %empty-directory(%t/include/Lib.swiftmodule) -// RUN: cp %S/Inputs/prebuilt-module-cache/Lib.swiftinterface %t/include/Lib.swiftmodule/%target-cpu.swiftinterface +// RUN: cp %S/Inputs/prebuilt-module-cache/Lib.swiftinterface %t/include/Lib.swiftmodule/%target-swiftinterface-name // Baseline check: if the prebuilt cache path does not exist, everything should // still work. diff --git a/test/ModuleInterface/ModuleCache/prebuilt-module-cache-unusable.swift b/test/ModuleInterface/ModuleCache/prebuilt-module-cache-unusable.swift index 94ae8eb3afc96..ad87dcadadb8e 100644 --- a/test/ModuleInterface/ModuleCache/prebuilt-module-cache-unusable.swift +++ b/test/ModuleInterface/ModuleCache/prebuilt-module-cache-unusable.swift @@ -2,10 +2,10 @@ // RUN: %empty-directory(%t/MCP) // RUN: %empty-directory(%t/prebuilt-cache/Lib.swiftmodule) // RUN: %empty-directory(%t/include/Lib.swiftmodule) -// RUN: cp %S/Inputs/prebuilt-module-cache/Lib.swiftinterface %t/include/Lib.swiftmodule/%target-cpu.swiftinterface +// RUN: cp %S/Inputs/prebuilt-module-cache/Lib.swiftinterface %t/include/Lib.swiftmodule/%target-swiftinterface-name // Prebuild a module for the current target CPU, and put it in the prebuilt cache under some imaginary CPU. -// RUN: sed -e 's/FromInterface/FromPrebuilt/g' %t/include/Lib.swiftmodule/%target-cpu.swiftinterface | %target-swift-frontend -parse-stdlib -module-cache-path %t/MCP -emit-module-path %t/prebuilt-cache/Lib.swiftmodule/leg128.swiftmodule - -module-name Lib +// RUN: sed -e 's/FromInterface/FromPrebuilt/g' %t/include/Lib.swiftmodule/%target-swiftinterface-name | %target-swift-frontend -parse-stdlib -module-cache-path %t/MCP -emit-module-path %t/prebuilt-cache/Lib.swiftmodule/leg128.swiftmodule - -module-name Lib // Make sure that, if there's a module for a different architecture // present in the prebuilt cache, it's ignored and the module is diff --git a/test/ModuleInterface/ModuleCache/prefer-local-module-to-sdk-framework.swift b/test/ModuleInterface/ModuleCache/prefer-local-module-to-sdk-framework.swift index 3f913718429ba..817263c769088 100644 --- a/test/ModuleInterface/ModuleCache/prefer-local-module-to-sdk-framework.swift +++ b/test/ModuleInterface/ModuleCache/prefer-local-module-to-sdk-framework.swift @@ -5,11 +5,11 @@ // RUN: echo 'public func showsUpInBothPlaces() {}' > %t/Lib.swift // 1. Create a .swiftinterface file containing just one API, and put it inside a second build dir (without a .swiftmodule) -// RUN: %target-swift-frontend -typecheck %t/Lib.swift -emit-module-interface-path %t/SecondBuildDir/Lib.framework/Modules/Lib.swiftmodule/%target-cpu.swiftinterface -module-name Lib +// RUN: %target-swift-frontend -typecheck %t/Lib.swift -emit-module-interface-path %t/SecondBuildDir/Lib.framework/Modules/Lib.swiftmodule/%target-swiftinterface-name -module-name Lib // 2. Add a new API to the module, and compile just the serialized version in the build dir. // RUN: echo 'public func onlyInTheCompiledModule() {}' >> %t/Lib.swift -// RUN: %target-swift-frontend -emit-module %t/Lib.swift -o %t/BuildDir/Lib.framework/Modules/Lib.swiftmodule/%target-cpu.swiftmodule -emit-module-interface-path %t/BuildDir/Lib.framework/Modules/Lib.swiftmodule/%target-cpu.swiftinterface -module-name Lib +// RUN: %target-swift-frontend -emit-module %t/Lib.swift -o %t/BuildDir/Lib.framework/Modules/Lib.swiftmodule/%target-swiftmodule-name -emit-module-interface-path %t/BuildDir/Lib.framework/Modules/Lib.swiftmodule/%target-swiftinterface-name -module-name Lib // 3. Make sure when we compile this test file, we can access both APIs since we'll // load the compiled .swiftmodule instead of the .swiftinterface in the SDK. @@ -19,7 +19,7 @@ // RUN: ls %t/ModuleCache | not grep 'swiftmodule' // 5. This should also work if the swiftinterface isn't present in the first build dir. -// RUN: rm %t/BuildDir/Lib.framework/Modules/Lib.swiftmodule/%target-cpu.swiftinterface +// RUN: rm %t/BuildDir/Lib.framework/Modules/Lib.swiftmodule/%target-swiftinterface-name // RUN: %target-swift-frontend -typecheck %s -F %t/BuildDir -F %t/SecondBuildDir -module-cache-path %t/ModuleCache // 6. Make sure we /still/ didn't compile any .swiftinterfaces into the module cache. diff --git a/test/ModuleInterface/default-prebuilt-module-location.swift b/test/ModuleInterface/default-prebuilt-module-location.swift index d5c9582b0e03e..fc2640a33f6da 100644 --- a/test/ModuleInterface/default-prebuilt-module-location.swift +++ b/test/ModuleInterface/default-prebuilt-module-location.swift @@ -10,7 +10,7 @@ // 3. Compile this into a module and put it into the default prebuilt cache // location relative to the fake resource dir. Also drop an interface into // the build dir. -// RUN: %target-swift-frontend -emit-module %t/PrebuiltModule.swift -o %t/ResourceDir/%target-sdk-name/prebuilt-modules/PrebuiltModule.swiftmodule/%target-cpu.swiftmodule -module-name PrebuiltModule -parse-stdlib -emit-module-interface-path %t/PrebuiltModule.swiftmodule/%target-cpu.swiftinterface +// RUN: %target-swift-frontend -emit-module %t/PrebuiltModule.swift -o %t/ResourceDir/%target-sdk-name/prebuilt-modules/PrebuiltModule.swiftmodule/%target-swiftmodule-name -module-name PrebuiltModule -parse-stdlib -emit-module-interface-path %t/PrebuiltModule.swiftmodule/%target-swiftinterface-name // 4. Import this prebuilt module, but DON'T pass in -prebuilt-module-cache-path, it should use the implicit one. // RUN: %target-swift-frontend -typecheck -resource-dir %t/ResourceDir -I %t %s -parse-stdlib -module-cache-path %t/ModuleCache -sdk %t diff --git a/test/ModuleInterface/swift_build_sdk_interfaces/check-only-mode.swift b/test/ModuleInterface/swift_build_sdk_interfaces/check-only-mode.swift index fa60a806ad84c..3e499cae7a30e 100644 --- a/test/ModuleInterface/swift_build_sdk_interfaces/check-only-mode.swift +++ b/test/ModuleInterface/swift_build_sdk_interfaces/check-only-mode.swift @@ -2,9 +2,9 @@ // RUN: mkdir -p %t/sdk/usr/lib/swift/Normal.swiftmodule // RUN: mkdir -p %t/sdk/System/Library/Frameworks/FMWK.framework/Modules/FMWK.swiftmodule -// RUN: echo 'public func normal() {}' | %target-swift-frontend - -emit-module-interface-path %t/sdk/usr/lib/swift/Normal.swiftmodule/%target-cpu.swiftinterface -emit-module -o /dev/null -module-name Normal +// RUN: echo 'public func normal() {}' | %target-swift-frontend - -emit-module-interface-path %t/sdk/usr/lib/swift/Normal.swiftmodule/%target-swiftinterface-name -emit-module -o /dev/null -module-name Normal // RUN: echo 'public func flat() {}' | %target-swift-frontend - -emit-module-interface-path %t/sdk/usr/lib/swift/Flat.swiftinterface -emit-module -o /dev/null -module-name Flat -// RUN: echo 'public func fmwk() {}' | %target-swift-frontend - -emit-module-interface-path %t/sdk/System/Library/Frameworks/FMWK.framework/Modules/FMWK.swiftmodule/%target-cpu.swiftinterface -emit-module -o /dev/null -module-name FMWK +// RUN: echo 'public func fmwk() {}' | %target-swift-frontend - -emit-module-interface-path %t/sdk/System/Library/Frameworks/FMWK.framework/Modules/FMWK.swiftmodule/%target-swiftinterface-name -emit-module -o /dev/null -module-name FMWK // RUN: %swift_build_sdk_interfaces -sdk %t/sdk -Fsystem %t/sdk/System/Library/Frameworks -v -o %t/prebuilt -check-only // RUN: ls %t/prebuilt | %FileCheck %s @@ -18,7 +18,7 @@ // Touch a file in the SDK (to make it look like it changed) and try again. // In -check-only mode, this should force a rebuild. // RUN: rm -rf %t/MCP -// RUN: %{python} %S/../ModuleCache/Inputs/make-old.py %t/sdk/usr/lib/swift/Normal.swiftmodule/%target-cpu.swiftinterface +// RUN: %{python} %S/../ModuleCache/Inputs/make-old.py %t/sdk/usr/lib/swift/Normal.swiftmodule/%target-swiftinterface-name // RUN: %target-typecheck-verify-swift -sdk %t/sdk -Fsystem %t/sdk/System/Library/Frameworks -I %t/sdk/usr/lib/swift/ -module-cache-path %t/MCP -prebuilt-module-cache-path %t/prebuilt // RUN: not %{python} %S/../ModuleCache/Inputs/check-is-forwarding-module.py %t/MCP/Normal-*.swiftmodule diff --git a/test/ModuleInterface/swift_build_sdk_interfaces/compiler-uses-prebuilt.swift b/test/ModuleInterface/swift_build_sdk_interfaces/compiler-uses-prebuilt.swift index fdc22b4e71093..352734a2a5dcd 100644 --- a/test/ModuleInterface/swift_build_sdk_interfaces/compiler-uses-prebuilt.swift +++ b/test/ModuleInterface/swift_build_sdk_interfaces/compiler-uses-prebuilt.swift @@ -2,9 +2,9 @@ // RUN: mkdir -p %t/sdk/usr/lib/swift/Normal.swiftmodule // RUN: mkdir -p %t/sdk/System/Library/Frameworks/FMWK.framework/Modules/FMWK.swiftmodule -// RUN: echo 'public func normal() {}' | %target-swift-frontend - -emit-module-interface-path %t/sdk/usr/lib/swift/Normal.swiftmodule/%target-cpu.swiftinterface -emit-module -o /dev/null -module-name Normal +// RUN: echo 'public func normal() {}' | %target-swift-frontend - -emit-module-interface-path %t/sdk/usr/lib/swift/Normal.swiftmodule/%target-swiftinterface-name -emit-module -o /dev/null -module-name Normal // RUN: echo 'public func flat() {}' | %target-swift-frontend - -emit-module-interface-path %t/sdk/usr/lib/swift/Flat.swiftinterface -emit-module -o /dev/null -module-name Flat -// RUN: echo 'public func fmwk() {}' | %target-swift-frontend - -emit-module-interface-path %t/sdk/System/Library/Frameworks/FMWK.framework/Modules/FMWK.swiftmodule/%target-cpu.swiftinterface -emit-module -o /dev/null -module-name FMWK +// RUN: echo 'public func fmwk() {}' | %target-swift-frontend - -emit-module-interface-path %t/sdk/System/Library/Frameworks/FMWK.framework/Modules/FMWK.swiftmodule/%target-swiftinterface-name -emit-module -o /dev/null -module-name FMWK // RUN: %swift_build_sdk_interfaces -sdk %t/sdk -Fsystem %t/sdk/System/Library/Frameworks -v -o %t/prebuilt // RUN: ls %t/prebuilt | %FileCheck %s @@ -19,7 +19,7 @@ // This should still be able to use the prebuilt modules because they track // content hashes, not just size+mtime. // RUN: rm -rf %t/MCP -// RUN: %{python} %S/../ModuleCache/Inputs/make-old.py %t/sdk/usr/lib/swift/Normal.swiftmodule/%target-cpu.swiftinterface +// RUN: %{python} %S/../ModuleCache/Inputs/make-old.py %t/sdk/usr/lib/swift/Normal.swiftmodule/%target-swiftinterface-name // RUN: %target-typecheck-verify-swift -sdk %t/sdk -Fsystem %t/sdk/System/Library/Frameworks -I %t/sdk/usr/lib/swift/ -module-cache-path %t/MCP -prebuilt-module-cache-path %t/prebuilt // RUN: ls %t/MCP/*.swiftmodule | %FileCheck -check-prefix CHECK-CACHE %s // RUN: %{python} %S/../ModuleCache/Inputs/check-is-forwarding-module.py %t/MCP/*.swiftmodule @@ -31,7 +31,7 @@ // Actually change a file in the SDK, to check that we're tracking dependencies // at all. // RUN: rm -rf %t/MCP -// RUN: echo "public func another()" >> %t/sdk/usr/lib/swift/Normal.swiftmodule/%target-cpu.swiftinterface +// RUN: echo "public func another()" >> %t/sdk/usr/lib/swift/Normal.swiftmodule/%target-swiftinterface-name // RUN: %target-typecheck-verify-swift -sdk %t/sdk -Fsystem %t/sdk/System/Library/Frameworks -I %t/sdk/usr/lib/swift/ -module-cache-path %t/MCP -prebuilt-module-cache-path %t/prebuilt // RUN: ls %t/MCP/*.swiftmodule | %FileCheck -check-prefix CHECK-CACHE %s // RUN: not %{python} %S/../ModuleCache/Inputs/check-is-forwarding-module.py %t/MCP/Normal-*.swiftmodule diff --git a/test/ModuleInterface/swift_build_sdk_interfaces/track-system-dependencies.swift b/test/ModuleInterface/swift_build_sdk_interfaces/track-system-dependencies.swift index bf3e764bd3a15..7703e3c677bbc 100644 --- a/test/ModuleInterface/swift_build_sdk_interfaces/track-system-dependencies.swift +++ b/test/ModuleInterface/swift_build_sdk_interfaces/track-system-dependencies.swift @@ -1,6 +1,6 @@ // RUN: %empty-directory(%t) // RUN: cp -r %S/Inputs/system-dependencies-sdk %t/sdk -// RUN: echo 'import Platform; public func usesCStruct(_: SomeCStruct?) {}' | %target-swift-frontend - -emit-module-interface-path %t/sdk/usr/lib/swift/Swifty.swiftmodule/%target-cpu.swiftinterface -emit-module -o /dev/null -module-name Swifty -sdk %t/sdk +// RUN: echo 'import Platform; public func usesCStruct(_: SomeCStruct?) {}' | %target-swift-frontend - -emit-module-interface-path %t/sdk/usr/lib/swift/Swifty.swiftmodule/%target-swiftinterface-name -emit-module -o /dev/null -module-name Swifty -sdk %t/sdk // RUN: %swift_build_sdk_interfaces -sdk %t/sdk -v -o %t/prebuilt // RUN: ls %t/prebuilt | %FileCheck %s diff --git a/test/Serialization/load-target-fallback.swift b/test/Serialization/load-target-fallback.swift index 40009c445073f..a3f919734a522 100644 --- a/test/Serialization/load-target-fallback.swift +++ b/test/Serialization/load-target-fallback.swift @@ -5,23 +5,23 @@ // RUN: mkdir %t/TargetLibrary.swiftmodule // RUN: %target-swift-frontend -emit-module -o %t/TargetLibrary.swiftmodule/%module-target-triple.swiftmodule %S/Inputs/def_func.swift -module-name TargetLibrary -// RUN: touch %t/TargetLibrary.swiftmodule/%target-cpu.swiftmodule +// RUN: touch %t/TargetLibrary.swiftmodule/%target-swiftmodule-name import TargetLibrary // RUN: mkdir %t/ArchLibrary.swiftmodule -// RUN: %target-swift-frontend -emit-module -o %t/ArchLibrary.swiftmodule/%target-cpu.swiftmodule %S/Inputs/def_func.swift -module-name ArchLibrary +// RUN: %target-swift-frontend -emit-module -o %t/ArchLibrary.swiftmodule/%target-swiftmodule-name %S/Inputs/def_func.swift -module-name ArchLibrary import ArchLibrary // RUN: mkdir -p %t/TargetModule.framework/Modules/TargetModule.swiftmodule // RUN: %target-swift-frontend -emit-module -o %t/TargetModule.framework/Modules/TargetModule.swiftmodule/%module-target-triple.swiftmodule %S/Inputs/def_func.swift -module-name TargetModule -// RUN: touch %t/TargetModule.framework/Modules/TargetModule.swiftmodule/%target-cpu.swiftmodule +// RUN: touch %t/TargetModule.framework/Modules/TargetModule.swiftmodule/%target-swiftmodule-name import TargetModule // RUN: mkdir -p %t/ArchModule.framework/Modules/ArchModule.swiftmodule -// RUN: %target-swift-frontend -emit-module -o %t/ArchModule.framework/Modules/ArchModule.swiftmodule/%target-cpu.swiftmodule %S/Inputs/def_func.swift -module-name ArchModule +// RUN: %target-swift-frontend -emit-module -o %t/ArchModule.framework/Modules/ArchModule.swiftmodule/%target-swiftmodule-name %S/Inputs/def_func.swift -module-name ArchModule import ArchModule diff --git a/test/lit.cfg b/test/lit.cfg index 81c20d27225ad..eb10093d42f5b 100644 --- a/test/lit.cfg +++ b/test/lit.cfg @@ -311,6 +311,11 @@ if run_vers.endswith('-simulator'): else: run_environment='' +target_arch = run_cpu +if run_os == 'openbsd' and run_cpu == 'amd64': + target_arch = run_cpu + run_cpu = 'x86_64' + run_ptrsize = '64' if ('64' in run_cpu or run_cpu == "s390x") else '32' run_ptrauth = 'ptrauth' if run_cpu == 'arm64e' else 'noptrauth' run_endian = 'little' if run_cpu != 's390x' else 'big' @@ -1625,7 +1630,7 @@ if swift_execution_tests_extra_flags: platform_module_dir = make_path(test_resource_dir, config.target_sdk_name) if run_vendor != 'apple': - platform_module_dir = make_path(platform_module_dir, run_cpu) + platform_module_dir = make_path(platform_module_dir, target_arch) platform_dylib_dir = platform_module_dir if run_os == 'maccatalyst' and config.darwin_maccatalyst_build_flavor == "ios-like": @@ -1873,6 +1878,7 @@ config.substitutions.append(('%xcode-extra-frameworks-dir', extra_frameworks_dir config.substitutions.append(('%target-swiftmodule-name', target_specific_module_triple + '.swiftmodule')) config.substitutions.append(('%target-swiftdoc-name', target_specific_module_triple + '.swiftdoc')) config.substitutions.append(('%target-swiftsourceinfo-name', target_specific_module_triple + '.swiftsourceinfo')) +config.substitutions.append(('%target-swiftinterface-name', target_specific_module_triple + '.swiftinterface')) config.substitutions.append(('%target-object-format', config.target_object_format)) config.substitutions.append(('%{target-shared-library-prefix}', config.target_shared_library_prefix)) From 15643777df533baa5d0a67fbc5a4ae0cebeedf03 Mon Sep 17 00:00:00 2001 From: Suyash Srijan Date: Sat, 13 Jun 2020 03:28:57 +0100 Subject: [PATCH 38/50] [CS] Update splice logic in simplifyLocator to handle situations where the index expression isn't a tuple or paren expression (#32356) --- lib/Sema/ConstraintSystem.cpp | 7 +++++++ .../compiler_crashers_2_fixed/sr12990.swift | 11 +++++++++++ 2 files changed, 18 insertions(+) create mode 100644 validation-test/compiler_crashers_2_fixed/sr12990.swift diff --git a/lib/Sema/ConstraintSystem.cpp b/lib/Sema/ConstraintSystem.cpp index e4f8310ed326d..1333ed4d09e3a 100644 --- a/lib/Sema/ConstraintSystem.cpp +++ b/lib/Sema/ConstraintSystem.cpp @@ -3451,6 +3451,13 @@ void constraints::simplifyLocator(ASTNode &anchor, if (auto subscriptExpr = getAsExpr(anchor)) { anchor = subscriptExpr->getIndex(); path = path.slice(1); + + // TODO: It would be better if the index expression was always wrapped + // in a ParenExpr (if there is no label). + if (!(isExpr(anchor) || isExpr(anchor)) && + !path.empty() && path[0].is()) { + path = path.slice(1); + } continue; } diff --git a/validation-test/compiler_crashers_2_fixed/sr12990.swift b/validation-test/compiler_crashers_2_fixed/sr12990.swift new file mode 100644 index 0000000000000..d3d68daed1bec --- /dev/null +++ b/validation-test/compiler_crashers_2_fixed/sr12990.swift @@ -0,0 +1,11 @@ +// RUN: %target-swift-frontend -typecheck %s -verify + +class ContainerTransition { + var viewControllers: [Int: String]? + func completeTransition() { + viewControllers?[Int//.max + // expected-error@-1 {{no exact matches in call to subscript}} + // expected-note@-2 {{found candidate with type '((Int).Type) -> Dictionary.SubSequence' (aka '(Int.Type) -> Slice>')}} + // expected-note@-3 {{to match this opening '['}} + } // expected-error {{expected ']' in expression list}} +} From 148436035be34390532300b58a6701ae51142322 Mon Sep 17 00:00:00 2001 From: Greg Titus Date: Sat, 13 Jun 2020 12:47:34 -0700 Subject: [PATCH 39/50] CS node->type map requires ordering because it can be partially undone, but Solution node->type map is all or nothing, so can be cheaper. --- lib/Sema/ConstraintSystem.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Sema/ConstraintSystem.h b/lib/Sema/ConstraintSystem.h index 4c93b2ef74571..0263164b986df 100644 --- a/lib/Sema/ConstraintSystem.h +++ b/lib/Sema/ConstraintSystem.h @@ -1016,7 +1016,7 @@ class Solution { llvm::SmallPtrSet DefaultedConstraints; /// The node -> type mappings introduced by this solution. - llvm::MapVector nodeTypes; + llvm::DenseMap nodeTypes; /// Contextual types introduced by this solution. std::vector> contextualTypes; From 7d7a35e445d0b94648f7f6619c13fb4008d222df Mon Sep 17 00:00:00 2001 From: Doug Gregor Date: Sat, 13 Jun 2020 23:54:45 -0700 Subject: [PATCH 40/50] [Runtime] Zero out the entire witness table during instantiation. During witness table instantiation, the witness table is constructed several sources: the pattern, the resilient witnesses, the private data, and default implementations. The private data area is the only one that was being zeroed out; the rest we rely on always filling in the data from the conformance descriptor and provided info. However, witness table instantiation uses the presence of a NULL pointer for a particular witness in the resulting table to indicate that no witness fulfilled that requirement, so that it can fill in the default witnesss. Except that, without zeroing that part of the table beforehand, we aren't guaranteed to have a NULL pointer for witness entries that the client (protocol conformance) did not know about at the time it was compiled. Zero out the entire witness table so default implementations can be filled in appropriately. Fixes rdar://problem/64295849. --- stdlib/public/runtime/Metadata.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/public/runtime/Metadata.cpp b/stdlib/public/runtime/Metadata.cpp index 4bcb9ef3ac7d9..b632dfc6f811f 100644 --- a/stdlib/public/runtime/Metadata.cpp +++ b/stdlib/public/runtime/Metadata.cpp @@ -4537,8 +4537,8 @@ WitnessTableCacheEntry::allocate( // Find the allocation. void **fullTable = reinterpret_cast(this + 1); - // Zero out the private storage area. - memset(fullTable, 0, privateSizeInWords * sizeof(void*)); + // Zero out the witness table. + memset(fullTable, 0, getWitnessTableSize(conformance)); // Advance the address point; the private storage area is accessed via // negative offsets. From 8bfaba76ffdcaea5078c91fbf0cb774361b6f8cd Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Sun, 14 Jun 2020 11:22:48 -0700 Subject: [PATCH 41/50] Update WindowsBuild.md The CI is switching to ICU 67 since there are fixes in the latter version of ICU that are needed. This should be further improved in the future to possibly use the the unicode.org releases. --- docs/WindowsBuild.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/WindowsBuild.md b/docs/WindowsBuild.md index 86ddaf91be1fb..0ca8b656501ff 100644 --- a/docs/WindowsBuild.md +++ b/docs/WindowsBuild.md @@ -91,7 +91,7 @@ Extract the zip files, ignoring the top level directory, into `S:/Library`. The ``` /Library - ┝ icu-64 + ┝ icu-67 │ ┕ usr/... ├ libcurl-development │ ┕ usr/... @@ -138,10 +138,10 @@ cmake -B "S:\b\toolchain" ^ -D LLDB_ENABLE_PYTHON=YES ^ -D LLVM_EXTERNAL_SWIFT_SOURCE_DIR="S:/swift" ^ -D LLVM_EXTERNAL_CMARK_SOURCE_DIR="S:/cmark" ^ - -D SWIFT_WINDOWS_x86_64_ICU_UC_INCLUDE="S:/Library/icu-64/usr/include" ^ - -D SWIFT_WINDOWS_x86_64_ICU_UC="S:/Library/icu-64/usr/lib/icuuc64.lib" ^ - -D SWIFT_WINDOWS_x86_64_ICU_I18N_INCLUDE="S:/Library/icu-64/usr/include" ^ - -D SWIFT_WINDOWS_x86_64_ICU_I18N="S:/Library/icu-64/usr/lib/icuin64.lib" ^ + -D SWIFT_WINDOWS_x86_64_ICU_UC_INCLUDE="S:/Library/icu-67/usr/include" ^ + -D SWIFT_WINDOWS_x86_64_ICU_UC="S:/Library/icu-67/usr/lib/icuuc67.lib" ^ + -D SWIFT_WINDOWS_x86_64_ICU_I18N_INCLUDE="S:/Library/icu-67/usr/include" ^ + -D SWIFT_WINDOWS_x86_64_ICU_I18N="S:/Library/icu-67/usr/lib/icuin67.lib" ^ -D CMAKE_INSTALL_PREFIX="C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr" ^ -D PYTHON_EXECUTABLE=C:\Python27\python.exe ^ -D SWIFT_BUILD_DYNAMIC_STDLIB=YES ^ @@ -158,7 +158,7 @@ ninja -C S:\b\toolchain ## Running Swift tests on Windows ```cmd -path S:\Library\icu-64\usr\bin;S:\b\toolchain\bin;S:\b\toolchain\tools\swift\libdispatch-prefix\bin;%PATH%;%ProgramFiles%\Git\usr\bin +path S:\Library\icu-67\usr\bin;S:\b\toolchain\bin;S:\b\toolchain\tools\swift\libdispatch-prefix\bin;%PATH%;%ProgramFiles%\Git\usr\bin ninja -C S:\b\toolchain check-swift ``` @@ -178,7 +178,7 @@ ninja -C S:\b\libdispatch check ## Build swift-corelibs-foundation ```cmd -cmake -B S:\b\foundation -D CMAKE_BUILD_TYPE=RelWithDebInfo -D CMAKE_C_COMPILER=S:/b/toolchain/bin/clang-cl.exe -D CMAKE_Swift_COMPILER=S:/b/toolchain/bin/swiftc.exe -D CURL_LIBRARY="S:/Library/libcurl-development/usr/lib/libcurl.lib" -D CURL_INCLUDE_DIR="S:/Library/libcurl-development/usr/include" -D ICU_ROOT="S:/Library/icu-64" -D ICU_INCLUDE_DIR=S:/Library/icu-64/usr/include -D LIBXML2_LIBRARY="S:/Library/libxml2-development/usr/lib/libxml2s.lib" -D LIBXML2_INCLUDE_DIR="S:/Library/libxml2-development/usr/include/libxml2" -D ENABLE_TESTING=NO -D dispatch_DIR=S:/b/libdispatch/cmake/modules -G Ninja -S S:\swift-corelibs-foundation +cmake -B S:\b\foundation -D CMAKE_BUILD_TYPE=RelWithDebInfo -D CMAKE_C_COMPILER=S:/b/toolchain/bin/clang-cl.exe -D CMAKE_Swift_COMPILER=S:/b/toolchain/bin/swiftc.exe -D CURL_LIBRARY="S:/Library/libcurl-development/usr/lib/libcurl.lib" -D CURL_INCLUDE_DIR="S:/Library/libcurl-development/usr/include" -D ICU_ROOT="S:/Library/icu-67" -D ICU_INCLUDE_DIR=S:/Library/icu-67/usr/include -D LIBXML2_LIBRARY="S:/Library/libxml2-development/usr/lib/libxml2s.lib" -D LIBXML2_INCLUDE_DIR="S:/Library/libxml2-development/usr/include/libxml2" -D ENABLE_TESTING=NO -D dispatch_DIR=S:/b/libdispatch/cmake/modules -G Ninja -S S:\swift-corelibs-foundation ninja -C S:\b\foundation ``` @@ -210,7 +210,7 @@ ninja -C S:\b\xctest check-xctest ## Rebuild Foundation ```cmd -cmake -B S:\b\foundation -D CMAKE_BUILD_TYPE=RelWithDebInfo -D CMAKE_C_COMPILER=S:/b/toolchain/bin/clang-cl.exe -D CMAKE_Swift_COMPILER=S:/b/toolchain/bin/swiftc.exe -D CURL_LIBRARY="S:/Library/libcurl-development/usr/lib/libcurl.lib" -D CURL_INCLUDE_DIR="S:/Library/libcurl-development/usr/include" -D ICU_ROOT="S:/Library/icu-64" -D LIBXML2_LIBRARY="S:/Library/libxml2-development/usr/lib/libxml2.lib" -D LIBXML2_INCLUDE_DIR="S:/Library/libxml2-development/usr/include" -D ENABLE_TESTING=YES -D dispatch_DIR=S:/b/libdispatch/cmake/modules -D XCTest_DIR=S:/b/xctest/cmake/modules -G Ninja -S S:\swift-corelibs-foundation +cmake -B S:\b\foundation -D CMAKE_BUILD_TYPE=RelWithDebInfo -D CMAKE_C_COMPILER=S:/b/toolchain/bin/clang-cl.exe -D CMAKE_Swift_COMPILER=S:/b/toolchain/bin/swiftc.exe -D CURL_LIBRARY="S:/Library/libcurl-development/usr/lib/libcurl.lib" -D CURL_INCLUDE_DIR="S:/Library/libcurl-development/usr/include" -D ICU_ROOT="S:/Library/icu-67" -D LIBXML2_LIBRARY="S:/Library/libxml2-development/usr/lib/libxml2.lib" -D LIBXML2_INCLUDE_DIR="S:/Library/libxml2-development/usr/include" -D ENABLE_TESTING=YES -D dispatch_DIR=S:/b/libdispatch/cmake/modules -D XCTest_DIR=S:/b/xctest/cmake/modules -G Ninja -S S:\swift-corelibs-foundation ninja -C S:\b\foundation ``` From 76ca05f7b15f38df03c177a76f40e29ffa71073e Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Fri, 12 Jun 2020 11:19:54 -0700 Subject: [PATCH 42/50] reland: Emit coverage mappings for all modules This reverts commit 499ed05fd9571c2633acc19c30fa36dcb07a6002. This changes the num-threads passed to 1 to avoid a multithreaded output issue on windows --- lib/IRGen/GenDecl.cpp | 7 +++++-- test/Profiler/Inputs/coverage_num_threads1.swift | 1 + test/Profiler/Inputs/coverage_num_threads2.swift | 1 + test/Profiler/coverage_num_threads.swift | 13 +++++++++++++ 4 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 test/Profiler/Inputs/coverage_num_threads1.swift create mode 100644 test/Profiler/Inputs/coverage_num_threads2.swift create mode 100644 test/Profiler/coverage_num_threads.swift diff --git a/lib/IRGen/GenDecl.cpp b/lib/IRGen/GenDecl.cpp index d50173195d07e..f79cec8c594e2 100644 --- a/lib/IRGen/GenDecl.cpp +++ b/lib/IRGen/GenDecl.cpp @@ -1105,8 +1105,11 @@ void IRGenerator::emitGlobalTopLevel(llvm::StringSet<> *linkerDirectives) { IGM->emitSILDifferentiabilityWitness(&dw); } - // Emit code coverage mapping data. - PrimaryIGM->emitCoverageMapping(); + // Emit code coverage mapping data for all modules + for (auto Iter : *this) { + IRGenModule *IGM = Iter.second; + IGM->emitCoverageMapping(); + } for (auto Iter : *this) { IRGenModule *IGM = Iter.second; diff --git a/test/Profiler/Inputs/coverage_num_threads1.swift b/test/Profiler/Inputs/coverage_num_threads1.swift new file mode 100644 index 0000000000000..6ca641732e7e1 --- /dev/null +++ b/test/Profiler/Inputs/coverage_num_threads1.swift @@ -0,0 +1 @@ +func func1() {} diff --git a/test/Profiler/Inputs/coverage_num_threads2.swift b/test/Profiler/Inputs/coverage_num_threads2.swift new file mode 100644 index 0000000000000..639ea1b4ad4b7 --- /dev/null +++ b/test/Profiler/Inputs/coverage_num_threads2.swift @@ -0,0 +1 @@ +func func2() {} diff --git a/test/Profiler/coverage_num_threads.swift b/test/Profiler/coverage_num_threads.swift new file mode 100644 index 0000000000000..12156483c079e --- /dev/null +++ b/test/Profiler/coverage_num_threads.swift @@ -0,0 +1,13 @@ +// RUN: %target-swift-frontend -profile-generate -profile-coverage-mapping -num-threads 0 -emit-ir %S/Inputs/coverage_num_threads1.swift | %FileCheck %s -check-prefix=SINGLE-SOURCE --implicit-check-not="llvm_coverage_mapping =" + +// SINGLE-SOURCE: llvm_coverage_mapping = + +// RUN: %target-swift-frontend -profile-generate -profile-coverage-mapping -num-threads 0 -emit-ir %S/Inputs/coverage_num_threads1.swift %S/Inputs/coverage_num_threads2.swift | %FileCheck %s -check-prefix=SINGLE-OBJECT --implicit-check-not="llvm_coverage_mapping =" + +// SINGLE-OBJECT: llvm_coverage_mapping = + +// Using 1 goes down the multithreaded codepath but only operates with a single thread to work around an issue on Windows where the output of both IR modules is interleaved and therefore the output is invalid +// RUN: %target-swift-frontend -profile-generate -profile-coverage-mapping -num-threads 1 -emit-ir %S/Inputs/coverage_num_threads1.swift %S/Inputs/coverage_num_threads2.swift | %FileCheck %s -check-prefix=MULTIPLE-OBJECTS --implicit-check-not="llvm_coverage_mapping =" + +// MULTIPLE-OBJECTS: llvm_coverage_mapping = +// MULTIPLE-OBJECTS: llvm_coverage_mapping = From e57d37599f157192fa2e7e54c2cc3d6193594101 Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Sun, 14 Jun 2020 13:36:35 -0700 Subject: [PATCH 43/50] build: do not assume that XML2 should be enabled Allow user control over libxml2 usage via `LLVM_ENABLE_LIBXML2` rather than assuming that if it is found, it should be enabled. --- test/CMakeLists.txt | 2 +- tools/swift-ide-test/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index e5eb7ec7db0e5..b29d88e60f575 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -218,7 +218,7 @@ foreach(SDK ${SWIFT_SDKS}) set(validation_test_bin_dir "${CMAKE_CURRENT_BINARY_DIR}/../validation-test${VARIANT_SUFFIX}") - if(LibXml2_FOUND) + if(LLVM_ENABLE_LIBXML2) set(SWIFT_HAVE_LIBXML2 TRUE) else() set(SWIFT_HAVE_LIBXML2 FALSE) diff --git a/tools/swift-ide-test/CMakeLists.txt b/tools/swift-ide-test/CMakeLists.txt index 095e97d5f155e..8f9614e8ad144 100644 --- a/tools/swift-ide-test/CMakeLists.txt +++ b/tools/swift-ide-test/CMakeLists.txt @@ -12,7 +12,7 @@ target_link_libraries(swift-ide-test swiftIDE) # If libxml2 is available, make it available for swift-ide-test. -if(LibXml2_FOUND) +if(LLVM_ENABLE_LIBXML2) include_directories(SYSTEM ${LIBXML2_INCLUDE_DIR}) target_link_libraries(swift-ide-test PRIVATE ${LIBXML2_LIBRARIES}) target_compile_definitions(swift-ide-test PRIVATE SWIFT_HAVE_LIBXML=1) From da53129beba61ed4a805d7283048d566872f808a Mon Sep 17 00:00:00 2001 From: Luciano Almeida Date: Mon, 15 Jun 2020 06:40:57 -0300 Subject: [PATCH 44/50] [CSSimplify] Adjusting naming and comments of method that validates representation conversions. --- lib/Sema/CSSimplify.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/Sema/CSSimplify.cpp b/lib/Sema/CSSimplify.cpp index 252fb22c95f0c..3fa6c530a3890 100644 --- a/lib/Sema/CSSimplify.cpp +++ b/lib/Sema/CSSimplify.cpp @@ -1349,11 +1349,11 @@ ConstraintSystem::matchTupleTypes(TupleType *tuple1, TupleType *tuple2, return getTypeMatchSuccess(); } -// Determine if a function representation conversion is allowed returning -// 'false' (i.e. no error) if the conversion is valid. +// Determine whether conversion is allowed between two function types +// based on their representations. static bool -matchFunctionConversionRepresentations(FunctionTypeRepresentation rep1, - FunctionTypeRepresentation rep2) { +isConversionAllowedBetween(FunctionTypeRepresentation rep1, + FunctionTypeRepresentation rep2) { auto isThin = [](FunctionTypeRepresentation rep) { return rep == FunctionTypeRepresentation::CFunctionPointer || rep == FunctionTypeRepresentation::Thin; @@ -1361,15 +1361,15 @@ matchFunctionConversionRepresentations(FunctionTypeRepresentation rep1, // Allowing "thin" (c, thin) to "thin" conventions if (isThin(rep1) && isThin(rep2)) - return false; + return true; // Allowing all to "thick" (swift, block) conventions // "thin" (c, thin) to "thick" or "thick" to "thick" if (rep2 == FunctionTypeRepresentation::Swift || rep2 == FunctionTypeRepresentation::Block) - return false; + return true; - return rep1 != rep2; + return rep1 == rep2; } // Returns 'false' (i.e. no error) if it is legal to match functions with the @@ -1390,7 +1390,9 @@ static bool matchFunctionRepresentations(FunctionTypeRepresentation rep1, if (!(last && last->is())) return false; - return matchFunctionConversionRepresentations(rep1, rep2); + // Inverting the result because matchFunctionRepresentations + // returns false in conversions are allowed. + return !isConversionAllowedBetween(rep1, rep2); } case ConstraintKind::OpaqueUnderlyingType: From 4b1ffa5314a65bb40ad9d1b33748e6b5921e401f Mon Sep 17 00:00:00 2001 From: Hamish Knight Date: Mon, 15 Jun 2020 12:01:04 -0700 Subject: [PATCH 45/50] [NameLookup] Ensure extensions are updated after module load Call prepareExtensions to make sure we load in any new extensions brought in by modules loaded after-the-fact. This isn't an issue for normal compilations as we load all the modules up-front in import resolution, but clients such as the LLDB REPL may load in modules later. Resolves rdar://64040436. --- lib/AST/NameLookup.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/AST/NameLookup.cpp b/lib/AST/NameLookup.cpp index 156c511cb590e..626715f458227 100644 --- a/lib/AST/NameLookup.cpp +++ b/lib/AST/NameLookup.cpp @@ -1331,6 +1331,12 @@ DirectLookupRequest::evaluate(Evaluator &evaluator, decl->prepareLookupTable(); + // If we're allowed to load extensions, call prepareExtensions to ensure we + // properly invalidate the lazily-complete cache for any extensions brought in + // by modules loaded after-the-fact. This can happen with the LLDB REPL. + if (!disableAdditionalExtensionLoading) + decl->prepareExtensions(); + auto &Table = *decl->LookupTable; if (!useNamedLazyMemberLoading) { // Make sure we have the complete list of members (in this nominal and in From 80e2b48d36a1b46d243f7a99e024780cd3e92501 Mon Sep 17 00:00:00 2001 From: Doug Gregor Date: Mon, 15 Jun 2020 14:26:28 -0700 Subject: [PATCH 46/50] [Test] Version cleanup --- .../Inherited/DeprecatedReplaced.swift | 20 +++++++++---------- .../Inherited/IntroducedReplaced.swift | 20 +++++++++---------- .../Inherited/ObsoletedReplaced.swift | 20 +++++++++---------- 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/test/SymbolGraph/Symbols/Mixins/Availability/Inherited/DeprecatedReplaced.swift b/test/SymbolGraph/Symbols/Mixins/Availability/Inherited/DeprecatedReplaced.swift index 0c63463dcda8c..0b6c04eba5a04 100644 --- a/test/SymbolGraph/Symbols/Mixins/Availability/Inherited/DeprecatedReplaced.swift +++ b/test/SymbolGraph/Symbols/Mixins/Availability/Inherited/DeprecatedReplaced.swift @@ -10,7 +10,7 @@ // REQUIRES: OS=macosx -@available(macOS, deprecated: 10.15) +@available(macOS, deprecated: 10.14) public struct S { // LESSTHAN-LABEL: "precise": "s:18DeprecatedReplaced1SV8lessThanyyF", // LESSTHAN: "availability": [ @@ -31,11 +31,11 @@ public struct S { // GREATERTHAN-NEXT: "domain": "macOS", // GREATERTHAN-NEXT: "deprecated": { // GREATERTHAN-NEXT: "major": 10, -// GREATERTHAN-NEXT: "minor": 15 +// GREATERTHAN-NEXT: "minor": 14 // GREATERTHAN-NEXT: } // GREATERTHAN-NEXT: } // GREATERTHAN-NEXT: ] - @available(macOS, deprecated: 10.16) + @available(macOS, deprecated: 10.15) public func greaterThan() {} // EQUAL-LABEL: "precise": "s:18DeprecatedReplaced1SV5equalyyF", @@ -44,15 +44,15 @@ public struct S { // EQUAL-NEXT: "domain": "macOS", // EQUAL-NEXT: "deprecated": { // EQUAL-NEXT: "major": 10, -// EQUAL-NEXT: "minor": 15 +// EQUAL-NEXT: "minor": 14 // EQUAL-NEXT: } // EQUAL-NEXT: } // EQUAL-NEXT: ] - @available(macOS, deprecated: 10.15) + @available(macOS, deprecated: 10.14) public func equal() {} } -@available(macOS, deprecated: 10.15) +@available(macOS, deprecated: 10.14) public struct Outer { public struct Inner { // TRANSITIVELESSTHAN-LABEL: "precise": "s:18DeprecatedReplaced5OuterV5InnerV8lessThanyyF" @@ -74,11 +74,11 @@ public struct Outer { // TRANSITIVEGREATERTHAN-NEXT: "domain": "macOS", // TRANSITIVEGREATERTHAN-NEXT: "deprecated": { // TRANSITIVEGREATERTHAN-NEXT: "major": 10, - // TRANSITIVEGREATERTHAN-NEXT: "minor": 15 + // TRANSITIVEGREATERTHAN-NEXT: "minor": 14 // TRANSITIVEGREATERTHAN-NEXT: } // TRANSITIVEGREATERTHAN-NEXT: } // TRANSITIVEGREATERTHAN-NEXT: ] - @available(macOS, deprecated: 10.16) + @available(macOS, deprecated: 10.15) public func greaterThan() {} // TRANSITIVEEQUAL-LABEL:"precise": "s:18DeprecatedReplaced5OuterV5InnerV5equalyyF" @@ -87,11 +87,11 @@ public struct Outer { // TRANSITIVEEQUAL-NEXT: "domain": "macOS", // TRANSITIVEEQUAL-NEXT: "deprecated": { // TRANSITIVEEQUAL-NEXT: "major": 10, - // TRANSITIVEEQUAL-NEXT: "minor": 15 + // TRANSITIVEEQUAL-NEXT: "minor": 14 // TRANSITIVEEQUAL-NEXT: } // TRANSITIVEEQUAL-NEXT: } // TRANSITIVEEQUAL-NEXT: ] - @available(macOS, deprecated: 10.15) + @available(macOS, deprecated: 10.14) public func equal() {} } } diff --git a/test/SymbolGraph/Symbols/Mixins/Availability/Inherited/IntroducedReplaced.swift b/test/SymbolGraph/Symbols/Mixins/Availability/Inherited/IntroducedReplaced.swift index 79bbf24ca5169..9ff58a173041b 100644 --- a/test/SymbolGraph/Symbols/Mixins/Availability/Inherited/IntroducedReplaced.swift +++ b/test/SymbolGraph/Symbols/Mixins/Availability/Inherited/IntroducedReplaced.swift @@ -8,7 +8,7 @@ // REQUIRES: OS=macosx -@available(macOS, introduced: 10.15) +@available(macOS, introduced: 10.14) public struct S { // Not possible: declarations cannot be more available than an enclosing scope // @available(macOS, introduced: 10.10) @@ -20,11 +20,11 @@ public struct S { // GREATERTHAN-NEXT: "domain": "macOS", // GREATERTHAN-NEXT: "introduced": { // GREATERTHAN-NEXT: "major": 10, - // GREATERTHAN-NEXT: "minor": 16 + // GREATERTHAN-NEXT: "minor": 15 // GREATERTHAN-NEXT: } // GREATERTHAN-NEXT: } // GREATERTHAN-NEXT: ] - @available(macOS, introduced: 10.16) + @available(macOS, introduced: 10.15) public func greaterThan() {} // EQUAL-LABEL: "precise": "s:18IntroducedReplaced1SV5equalyyF", @@ -33,15 +33,15 @@ public struct S { // EQUAL-NEXT: "domain": "macOS", // EQUAL-NEXT: "introduced": { // EQUAL-NEXT: "major": 10, - // EQUAL-NEXT: "minor": 15 + // EQUAL-NEXT: "minor": 14 // EQUAL-NEXT: } // EQUAL-NEXT: } // EQUAL-NEXT: ] - @available(macOS, introduced: 10.15) + @available(macOS, introduced: 10.14) public func equal() {} } -@available(macOS, introduced: 10.15) +@available(macOS, introduced: 10.14) public struct Outer { public struct Inner { // TRANSITIVEGREATERTHAN-LABEL: "precise": "s:18IntroducedReplaced5OuterV5InnerV11greaterThanyyF" @@ -50,11 +50,11 @@ public struct Outer { // TRANSITIVEGREATERTHAN-NEXT: "domain": "macOS", // TRANSITIVEGREATERTHAN-NEXT: "introduced": { // TRANSITIVEGREATERTHAN-NEXT: "major": 10, - // TRANSITIVEGREATERTHAN-NEXT: "minor": 16 + // TRANSITIVEGREATERTHAN-NEXT: "minor": 15 // TRANSITIVEGREATERTHAN-NEXT: } // TRANSITIVEGREATERTHAN-NEXT: } // TRANSITIVEGREATERTHAN-NEXT: ] - @available(macOS, introduced: 10.16) + @available(macOS, introduced: 10.15) public func greaterThan() {} // TRANSITIVEEQUAL-LABEL: precise": "s:18IntroducedReplaced5OuterV5InnerV5equalyyF" @@ -63,11 +63,11 @@ public struct Outer { // TRANSITIVEEQUAL-NEXT: "domain": "macOS", // TRANSITIVEEQUAL-NEXT: "introduced": { // TRANSITIVEEQUAL-NEXT: "major": 10, - // TRANSITIVEEQUAL-NEXT: "minor": 15 + // TRANSITIVEEQUAL-NEXT: "minor": 14 // TRANSITIVEEQUAL-NEXT: } // TRANSITIVEEQUAL-NEXT: } // TRANSITIVEEQUAL-NEXT: ] - @available(macOS, introduced: 10.15) + @available(macOS, introduced: 10.14) public func equal() {} } } diff --git a/test/SymbolGraph/Symbols/Mixins/Availability/Inherited/ObsoletedReplaced.swift b/test/SymbolGraph/Symbols/Mixins/Availability/Inherited/ObsoletedReplaced.swift index 7ac2ebe996032..0674311d40c2f 100644 --- a/test/SymbolGraph/Symbols/Mixins/Availability/Inherited/ObsoletedReplaced.swift +++ b/test/SymbolGraph/Symbols/Mixins/Availability/Inherited/ObsoletedReplaced.swift @@ -10,7 +10,7 @@ // REQUIRES: OS=macosx -@available(macOS, obsoleted: 10.15) +@available(macOS, obsoleted: 10.14) public struct S { // LESSTHAN-LABEL: "precise": "s:17ObsoletedReplaced1SV8lessThanyyF", // LESSTHAN: "availability": [ @@ -31,11 +31,11 @@ public struct S { // GREATERTHAN-NEXT: "domain": "macOS", // GREATERTHAN-NEXT: "obsoleted": { // GREATERTHAN-NEXT: "major": 10, - // GREATERTHAN-NEXT: "minor": 15 + // GREATERTHAN-NEXT: "minor": 14 // GREATERTHAN-NEXT: } // GREATERTHAN-NEXT: } // GREATERTHAN-NEXT: ] - @available(macOS, obsoleted: 10.16) + @available(macOS, obsoleted: 10.15) public func greaterThan() {} // EQUAL-LABEL: "precise": "s:17ObsoletedReplaced1SV5equalyyF", @@ -44,15 +44,15 @@ public struct S { // EQUAL-NEXT: "domain": "macOS", // EQUAL-NEXT: "obsoleted": { // EQUAL-NEXT: "major": 10, - // EQUAL-NEXT: "minor": 15 + // EQUAL-NEXT: "minor": 14 // EQUAL-NEXT: } // EQUAL-NEXT: } // EQUAL-NEXT: ] - @available(macOS, obsoleted: 10.15) + @available(macOS, obsoleted: 10.14) public func equal() {} } -@available(macOS, obsoleted: 10.15) +@available(macOS, obsoleted: 10.14) public struct Outer { public struct Inner { // TRANSITIVELESSTHAN-LABEL: "precise": "s:17ObsoletedReplaced5OuterV5InnerV8lessThanyyF" @@ -74,11 +74,11 @@ public struct Outer { // TRANSITIVEGREATERTHAN-NEXT: "domain": "macOS", // TRANSITIVEGREATERTHAN-NEXT: "obsoleted": { // TRANSITIVEGREATERTHAN-NEXT: "major": 10, - // TRANSITIVEGREATERTHAN-NEXT: "minor": 15 + // TRANSITIVEGREATERTHAN-NEXT: "minor": 14 // TRANSITIVEGREATERTHAN-NEXT: } // TRANSITIVEGREATERTHAN-NEXT: } // TRANSITIVEGREATERTHAN-NEXT: ] - @available(macOS, obsoleted: 10.16) + @available(macOS, obsoleted: 10.15) public func greaterThan() {} // TRANSITIVEEQUAL-LABEL:"precise": "s:17ObsoletedReplaced5OuterV5InnerV5equalyyF" @@ -87,11 +87,11 @@ public struct Outer { // TRANSITIVEEQUAL-NEXT: "domain": "macOS", // TRANSITIVEEQUAL-NEXT: "obsoleted": { // TRANSITIVEEQUAL-NEXT: "major": 10, - // TRANSITIVEEQUAL-NEXT: "minor": 15 + // TRANSITIVEEQUAL-NEXT: "minor": 14 // TRANSITIVEEQUAL-NEXT: } // TRANSITIVEEQUAL-NEXT: } // TRANSITIVEEQUAL-NEXT: ] - @available(macOS, obsoleted: 10.15) + @available(macOS, obsoleted: 10.14) public func equal() {} } } From 8573d70e4742cc4f210017c6b73ef15dbb23cbf1 Mon Sep 17 00:00:00 2001 From: Suyash Srijan Date: Tue, 16 Jun 2020 00:47:58 +0100 Subject: [PATCH 47/50] [Typechecker] Diagnose use of magic literals as raw value for enum case (#32364) --- include/swift/AST/DiagnosticsSema.def | 3 +++ lib/Sema/TypeCheckDecl.cpp | 18 +++++++++++++++--- ...um_raw_representable_object_literals.swift | 19 +++++++++++++++++++ .../compiler_crashers_2_fixed/sr12998.swift | 19 +++++++++++++++++++ 4 files changed, 56 insertions(+), 3 deletions(-) create mode 100644 test/Sema/enum_raw_representable_object_literals.swift create mode 100644 validation-test/compiler_crashers_2_fixed/sr12998.swift diff --git a/include/swift/AST/DiagnosticsSema.def b/include/swift/AST/DiagnosticsSema.def index d12b61b251394..7467f35798830 100644 --- a/include/swift/AST/DiagnosticsSema.def +++ b/include/swift/AST/DiagnosticsSema.def @@ -2668,6 +2668,9 @@ ERROR(enum_non_integer_convertible_raw_type_no_value,none, "expressible by integer or string literal", ()) ERROR(enum_raw_value_not_unique,none, "raw value for enum case is not unique", ()) +ERROR(enum_raw_value_magic_literal,none, + "use of '%0' literal as raw value for enum case is not supported", + (StringRef)) NOTE(enum_raw_value_used_here,none, "raw value previously used here", ()) NOTE(enum_raw_value_incrementing_from_here,none, diff --git a/lib/Sema/TypeCheckDecl.cpp b/lib/Sema/TypeCheckDecl.cpp index 333583258b1b6..f94d7a08bc4e2 100644 --- a/lib/Sema/TypeCheckDecl.cpp +++ b/lib/Sema/TypeCheckDecl.cpp @@ -1082,6 +1082,21 @@ EnumRawValuesRequest::evaluate(Evaluator &eval, EnumDecl *ED, if (ED->LazySemanticInfo.hasFixedRawValues()) continue; + // Using magic literals like #file as raw value is not supported right now. + // TODO: We could potentially support #file, #function, #line and #column. + auto &Diags = ED->getASTContext().Diags; + SourceLoc diagLoc = uncheckedRawValueOf(elt)->isImplicit() + ? elt->getLoc() + : uncheckedRawValueOf(elt)->getLoc(); + if (auto magicLiteralExpr = + dyn_cast(prevValue)) { + auto kindString = + magicLiteralExpr->getKindString(magicLiteralExpr->getKind()); + Diags.diagnose(diagLoc, diag::enum_raw_value_magic_literal, kindString); + elt->setInvalid(); + continue; + } + // Check that the raw value is unique. RawValueKey key{prevValue}; RawValueSource source{elt, lastExplicitValueElt}; @@ -1091,9 +1106,6 @@ EnumRawValuesRequest::evaluate(Evaluator &eval, EnumDecl *ED, continue; // Diagnose the duplicate value. - auto &Diags = ED->getASTContext().Diags; - SourceLoc diagLoc = uncheckedRawValueOf(elt)->isImplicit() - ? elt->getLoc() : uncheckedRawValueOf(elt)->getLoc(); Diags.diagnose(diagLoc, diag::enum_raw_value_not_unique); assert(lastExplicitValueElt && "should not be able to have non-unique raw values when " diff --git a/test/Sema/enum_raw_representable_object_literals.swift b/test/Sema/enum_raw_representable_object_literals.swift new file mode 100644 index 0000000000000..f70bbcea068ce --- /dev/null +++ b/test/Sema/enum_raw_representable_object_literals.swift @@ -0,0 +1,19 @@ +// RUN: %target-typecheck-verify-swift +// REQUIRES: OS=ios + +import UIKit + +struct FooLiteral: _ExpressibleByColorLiteral, _ExpressibleByImageLiteral, _ExpressibleByFileReferenceLiteral { + init(_colorLiteralRed: Float, green: Float, blue: Float, alpha: Float) {} + init(imageLiteralResourceName: String) {} + init(fileReferenceLiteralResourceName: String) {} +} + +enum Foo: FooLiteral { // expected-error {{raw type 'FooLiteral' is not expressible by a string, integer, or floating-point literal}} + typealias RawValue = Never + var rawValue: Never { fatalError() } + init(rawValue: Never) { fatalError() } + case bar1 = #colorLiteral(red: 1, green: 0, blue: 0, alpha: 1) + case bar2 = #imageLiteral(resourceName: "hello.png") + case bar3 = #fileLiteral(resourceName: "what.txt") +} diff --git a/validation-test/compiler_crashers_2_fixed/sr12998.swift b/validation-test/compiler_crashers_2_fixed/sr12998.swift new file mode 100644 index 0000000000000..d9c32eeb9bd22 --- /dev/null +++ b/validation-test/compiler_crashers_2_fixed/sr12998.swift @@ -0,0 +1,19 @@ +// RUN: %target-swift-frontend -typecheck %s -verify + +enum FooString: String { // expected-error {{'FooString' declares raw type 'String', but does not conform to RawRepresentable and conformance could not be synthesized}} + case bar1 = #file // expected-error {{use of '#file' literal as raw value for enum case is not supported}} + case bar2 = #function // expected-error {{use of '#function' literal as raw value for enum case is not supported}} + case bar3 = #filePath // expected-error {{use of '#filePath' literal as raw value for enum case is not supported}} + case bar4 = #line // expected-error {{cannot convert value of type 'Int' to raw type 'String'}} + case bar5 = #column // expected-error {{cannot convert value of type 'Int' to raw type 'String'}} + case bar6 = #dsohandle // expected-error {{cannot convert value of type 'UnsafeRawPointer' to raw type 'String'}} +} + +enum FooInt: Int { // expected-error {{'FooInt' declares raw type 'Int', but does not conform to RawRepresentable and conformance could not be synthesized}} + case bar1 = #file // expected-error {{cannot convert value of type 'String' to raw type 'Int'}} + case bar2 = #function // expected-error {{cannot convert value of type 'String' to raw type 'Int'}} + case bar3 = #filePath // expected-error {{cannot convert value of type 'String' to raw type 'Int'}} + case bar4 = #line // expected-error {{use of '#line' literal as raw value for enum case is not supported}} + case bar5 = #column // expected-error {{use of '#column' literal as raw value for enum case is not supported}} + case bar6 = #dsohandle // expected-error {{cannot convert value of type 'UnsafeRawPointer' to raw type 'Int'}} +} From 542721bbf4cd779fc837b79749f1c81cd23b8550 Mon Sep 17 00:00:00 2001 From: Dan Zheng Date: Mon, 15 Jun 2020 18:28:07 -0700 Subject: [PATCH 48/50] [AutoDiff] Disable flaky tests on Linux. (#32394) Disable tests that occasionally flake on Linux. SR-13021 tracks re-enabling these tests. --- ...function-extract-subst-function-type.swift | 3 ++ ...noderivative-parameter-type-mangling.swift | 40 +++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 test/AutoDiff/compiler_crashers_fixed/sr12650-noderivative-parameter-type-mangling.swift diff --git a/test/AutoDiff/compiler_crashers_fixed/sr12493-differentiable-function-extract-subst-function-type.swift b/test/AutoDiff/compiler_crashers_fixed/sr12493-differentiable-function-extract-subst-function-type.swift index 98952bf453ed4..359c1d2ddb845 100644 --- a/test/AutoDiff/compiler_crashers_fixed/sr12493-differentiable-function-extract-subst-function-type.swift +++ b/test/AutoDiff/compiler_crashers_fixed/sr12493-differentiable-function-extract-subst-function-type.swift @@ -3,6 +3,9 @@ // SR-12493: SIL verification error regarding substituted function types and // `differentiable_function_extract` instruction. Occurs only with `-O`. +// FIXME(SR-13021): Disabled due to flakiness on Linux. +// REQUIRES: SR13021 + import _Differentiation func exampleVJP_1(_ x0: Float) -> (Float, (Float) -> (Float)) { diff --git a/test/AutoDiff/compiler_crashers_fixed/sr12650-noderivative-parameter-type-mangling.swift b/test/AutoDiff/compiler_crashers_fixed/sr12650-noderivative-parameter-type-mangling.swift new file mode 100644 index 0000000000000..9258d97c063c0 --- /dev/null +++ b/test/AutoDiff/compiler_crashers_fixed/sr12650-noderivative-parameter-type-mangling.swift @@ -0,0 +1,40 @@ +// RUN: %target-build-swift -g %s + +// SR-12650: IRGenDebugInfo type reconstruction crash because `@noDerivative` +// parameters are not mangled. + +// FIXME(SR-13021): Disabled due to flakiness on Linux. +// REQUIRES: SR13021 + +import _Differentiation +func id(_ x: Float, _ y: Float) -> Float { x } +let transformed: @differentiable (Float, @noDerivative Float) -> Float = id + +// Incorrect reconstructed type for $sS3fIedgyyd_D +// Original type: +// (sil_function_type type=@differentiable @callee_guaranteed (Float, @noDerivative Float) -> Float +// (input=struct_type decl=Swift.(file).Float) +// (input=struct_type decl=Swift.(file).Float) +// (result=struct_type decl=Swift.(file).Float) +// (substitution_map generic_signature=) +// (substitution_map generic_signature=)) +// Reconstructed type: +// (sil_function_type type=@differentiable @callee_guaranteed (Float, Float) -> Float +// (input=struct_type decl=Swift.(file).Float) +// (input=struct_type decl=Swift.(file).Float) +// (result=struct_type decl=Swift.(file).Float) +// (substitution_map generic_signature=) +// (substitution_map generic_signature=)) +// Stack dump: +// ... +// 1. Swift version 5.3-dev (LLVM 803d1b184d, Swift 477af9f90d) +// 2. While evaluating request IRGenSourceFileRequest(IR Generation for file "noderiv.swift") +// 0 swift 0x00000001104c7ae8 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40 +// 1 swift 0x00000001104c6a68 llvm::sys::RunSignalHandlers() + 248 +// 2 swift 0x00000001104c80dd SignalHandler(int) + 285 +// 3 libsystem_platform.dylib 0x00007fff718335fd _sigtramp + 29 +// 4 libsystem_platform.dylib 000000000000000000 _sigtramp + 18446603338611739168 +// 5 libsystem_c.dylib 0x00007fff71709808 abort + 120 +// 6 swift 0x0000000110604152 (anonymous namespace)::IRGenDebugInfoImpl::getOrCreateType(swift::irgen::DebugTypeInfo) (.cold.20) + 146 +// 7 swift 0x000000010c24ab1e (anonymous namespace)::IRGenDebugInfoImpl::getOrCreateType(swift::irgen::DebugTypeInfo) + 3614 +// 8 swift 0x000000010c245437 swift::irgen::IRGenDebugInfo::emitGlobalVariableDeclaration(llvm::GlobalVariable*, llvm::StringRef, llvm::StringRef, swift::irgen::DebugTypeInfo, bool, bool, llvm::Optional) + 167 From aefeab859e72c0ec4793518615817c08ba8ba939 Mon Sep 17 00:00:00 2001 From: David Zarzycki Date: Fri, 12 Jun 2020 09:15:17 -0400 Subject: [PATCH 49/50] [Basic] Revise version printing Now that we use the LLVM mono-repo, we don't need to worry about clang's version number. Also, git has the ability to estimate the safe number of digits a hash can be truncated to and now git estimates that large projects like LLVM and Linux "require" 12 digits for safe commit hash abbreviation. Let's stay a little ahead of the curve and statically truncate to 15. --- lib/Basic/CMakeLists.txt | 1 - lib/Basic/Version.cpp | 24 +++++++----------------- 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/lib/Basic/CMakeLists.txt b/lib/Basic/CMakeLists.txt index c1ed3d503bebc..47bee7793ac61 100644 --- a/lib/Basic/CMakeLists.txt +++ b/lib/Basic/CMakeLists.txt @@ -34,7 +34,6 @@ function(generate_revision_inc revision_inc_var name dir) endfunction() generate_revision_inc(llvm_revision_inc LLVM "${LLVM_MAIN_SRC_DIR}") -generate_revision_inc(clang_revision_inc Clang "${CLANG_MAIN_SRC_DIR}") generate_revision_inc(swift_revision_inc Swift "${SWIFT_SOURCE_DIR}") add_swift_host_library(swiftBasic STATIC diff --git a/lib/Basic/Version.cpp b/lib/Basic/Version.cpp index f15f4d63be0bb..37ccda1de0bce 100644 --- a/lib/Basic/Version.cpp +++ b/lib/Basic/Version.cpp @@ -45,34 +45,25 @@ #endif #include "LLVMRevision.inc" -#include "ClangRevision.inc" #include "SwiftRevision.inc" namespace swift { namespace version { -/// Print a string of the form "LLVM xxxxx, Clang yyyyy, Swift zzzzz", -/// where each placeholder is the revision for the associated repository. +/// Print a string of the form "LLVM xxxxx, Swift zzzzz", where each placeholder +/// is the revision for the associated repository. static void printFullRevisionString(raw_ostream &out) { - // Arbitrarily truncate to 10 characters. This should be enough to unique - // Git hashes for the time being, and certainly enough for SVN revisions, - // while keeping the version string from being ridiculously long. + // Arbitrarily truncate to 15 characters. This should be enough to unique Git + // hashes while keeping the REPL version string from overflowing 80 columns. #if defined(LLVM_REVISION) - out << "LLVM " << StringRef(LLVM_REVISION).slice(0, 10); -# if defined(CLANG_REVISION) || defined(SWIFT_REVISION) - out << ", "; -# endif -#endif - -#if defined(CLANG_REVISION) - out << "Clang " << StringRef(CLANG_REVISION).slice(0, 10); + out << "LLVM " << StringRef(LLVM_REVISION).slice(0, 15); # if defined(SWIFT_REVISION) out << ", "; # endif #endif #if defined(SWIFT_REVISION) - out << "Swift " << StringRef(SWIFT_REVISION).slice(0, 10); + out << "Swift " << StringRef(SWIFT_REVISION).slice(0, 15); #endif } @@ -424,8 +415,7 @@ std::string getSwiftFullVersion(Version effectiveVersion) { OS << " clang-" CLANG_COMPILER_VERSION; #endif OS << ")"; -#elif defined(LLVM_REVISION) || defined(CLANG_REVISION) || \ - defined(SWIFT_REVISION) +#elif defined(LLVM_REVISION) || defined(SWIFT_REVISION) OS << " ("; printFullRevisionString(OS); OS << ")"; From ced3b393686de51b716b876b9cc6e24cfc9041ab Mon Sep 17 00:00:00 2001 From: David Zarzycki Date: Tue, 16 Jun 2020 07:25:11 -0400 Subject: [PATCH 50/50] [SIL] NFC: Fix -Wdeprecated-copy warnings The rule-of-zero is your friend. Also, switch to `class` and make the `value` private while we're touching these types. --- include/swift/SIL/OwnershipUtils.h | 45 ++++++++++++++++++------------ 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/include/swift/SIL/OwnershipUtils.h b/include/swift/SIL/OwnershipUtils.h index c2d6b45336597..4f2a36d7282aa 100644 --- a/include/swift/SIL/OwnershipUtils.h +++ b/include/swift/SIL/OwnershipUtils.h @@ -66,18 +66,20 @@ bool isOwnedForwardingInstruction(SILInstruction *inst); /// previous terminator. bool isOwnedForwardingValue(SILValue value); -struct BorrowingOperandKind { - enum Kind { +class BorrowingOperandKind { +public: + enum Kind : uint8_t { BeginBorrow, BeginApply, Branch, }; +private: Kind value; +public: BorrowingOperandKind(Kind newValue) : value(newValue) {} - BorrowingOperandKind(const BorrowingOperandKind &other) - : value(other.value) {} + operator Kind() const { return value; } static Optional get(SILInstructionKind kind) { @@ -207,15 +209,20 @@ struct BorrowingOperand { llvm::raw_ostream &operator<<(llvm::raw_ostream &os, const BorrowingOperand &operand); -struct BorrowedValueKind { +class BorrowedValueKind { +public: /// Enum we use for exhaustive pattern matching over borrow scope introducers. - enum Kind { + enum Kind : uint8_t { LoadBorrow, BeginBorrow, SILFunctionArgument, Phi, }; +private: + Kind value; + +public: static Optional get(SILValue value) { if (value.getOwnershipKind() != ValueOwnershipKind::Guaranteed) return None; @@ -240,10 +247,8 @@ struct BorrowedValueKind { } } - Kind value; - BorrowedValueKind(Kind newValue) : value(newValue) {} - BorrowedValueKind(const BorrowedValueKind &other) : value(other.value) {} + operator Kind() const { return value; } /// Is this a borrow scope that begins and ends within the same function and @@ -383,18 +388,20 @@ bool getAllBorrowIntroducingValues(SILValue value, /// introducer, then we return a .some(BorrowScopeIntroducingValue). Optional getSingleBorrowIntroducingValue(SILValue inputValue); -struct InteriorPointerOperandKind { +class InteriorPointerOperandKind { +public: enum Kind : uint8_t { RefElementAddr, RefTailAddr, OpenExistentialBox, }; +private: Kind value; +public: InteriorPointerOperandKind(Kind newValue) : value(newValue) {} - InteriorPointerOperandKind(const InteriorPointerOperandKind &other) - : value(other.value) {} + operator Kind() const { return value; } static Optional get(Operand *use) { @@ -467,8 +474,9 @@ struct InteriorPointerOperand { : operand(op), kind(kind) {} }; -struct OwnedValueIntroducerKind { - enum Kind { +class OwnedValueIntroducerKind { +public: + enum Kind : uint8_t { /// An owned value that is a result of an Apply. Apply, @@ -519,6 +527,10 @@ struct OwnedValueIntroducerKind { AllocRefInit, }; +private: + Kind value; + +public: static Optional get(SILValue value) { if (value.getOwnershipKind() != ValueOwnershipKind::Owned) return None; @@ -569,11 +581,8 @@ struct OwnedValueIntroducerKind { llvm_unreachable("Default should have caught this"); } - Kind value; - OwnedValueIntroducerKind(Kind newValue) : value(newValue) {} - OwnedValueIntroducerKind(const OwnedValueIntroducerKind &other) - : value(other.value) {} + operator Kind() const { return value; } void print(llvm::raw_ostream &os) const;