mirror of
https://github.com/github/codeql.git
synced 2026-05-14 11:19:27 +02:00
Swift: Expose the declared interface type of a type decl
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,3 @@
|
||||
description: Expose declared interface types
|
||||
compatibility: full
|
||||
type_decls.rel: reorder type_decls.rel (@type_decl id, string name, @type_or_none declared_interface_type) id name
|
||||
@@ -299,6 +299,7 @@ void DeclTranslator::fillTypeDecl(const swift::TypeDecl& decl, codeql::TypeDecl&
|
||||
entry.inherited_types.push_back(dispatcher.fetchLabel(type));
|
||||
}
|
||||
}
|
||||
entry.declared_interface_type = dispatcher.fetchLabel(decl.getDeclaredInterfaceType());
|
||||
fillValueDecl(decl, entry);
|
||||
}
|
||||
|
||||
|
||||
14
swift/ql/.generated.list
generated
14
swift/ql/.generated.list
generated
@@ -741,7 +741,7 @@ lib/codeql/swift/generated/Location.qll 5e20316c3e480ddfe632b7e88e016c19f10a67df
|
||||
lib/codeql/swift/generated/MacroRole.qll facf907e75490d69cd401c491215e4719324d751f40ea46c86ccf24cf3663c1f 969d8d4b44e3f1a9c193a152a4d83a303e56d2dbb871fc920c47a33f699cf018
|
||||
lib/codeql/swift/generated/ParentChild.qll 669d39245f2cb735cfd4bcebdb551ef8f334fef5297c5834a8b09ebfa655856e 59b283c8a30b6b364c853302ab919ea713e0289e7b793b08b46fc87178d14a6a
|
||||
lib/codeql/swift/generated/PureSynthConstructors.qll bc31a6c4d142fa3fbdcae69d5ba6f1cec00eb9ad92b46c8d7b91ebfa7ef6c1f4 bc31a6c4d142fa3fbdcae69d5ba6f1cec00eb9ad92b46c8d7b91ebfa7ef6c1f4
|
||||
lib/codeql/swift/generated/Raw.qll 0090c6509cb3fa5a67c996a2fc22e6338caef19701ca19463965b55b3c63096f 578329fa3abbabbadbff5e364e9c8d7ad76b41d4c17ad76e0660d41f48746659
|
||||
lib/codeql/swift/generated/Raw.qll a21e4f931d2bfcd9d964a7b930a81e7c169dc7ed7611f195087ea664745f90ea 3594391128bf4f3fb387ce386ab0f1ef070b7fa046425b6b4152f13b21d0a754
|
||||
lib/codeql/swift/generated/Synth.qll e30b50d2645d9c36719d81f1be70712c7c6e89a3f5b4a5ae894411e045d05bff 9bd0c9c90532db97cde9553dde4089b7cf12c462c690d853fa40cb36ea112c21
|
||||
lib/codeql/swift/generated/SynthConstructors.qll c40f01e1331bdbe238620a41d17409cefe34a6b23066708ef5d74f8631b54f48 c40f01e1331bdbe238620a41d17409cefe34a6b23066708ef5d74f8631b54f48
|
||||
lib/codeql/swift/generated/UnknownFile.qll 247ddf2ebb49ce5ed4bf7bf91a969ddff37de6c78d43d8affccaf7eb586e06f2 452b29f0465ef45e978ef8b647b75e5a2a1e53f2a568fc003bc8f52f73b3fa4d
|
||||
@@ -787,7 +787,7 @@ lib/codeql/swift/generated/decl/StructDecl.qll baa06ebff9619339b461342828f952693
|
||||
lib/codeql/swift/generated/decl/SubscriptDecl.qll 18d84b4ef27ecb732ac4350b8b01cb8c48db5182680f6893d392d5994919ca97 fcb5fe713326957a5bdf9bb9098f979c77778c02252dcb9c6d915a8d15eb65cf
|
||||
lib/codeql/swift/generated/decl/TopLevelCodeDecl.qll b327da6de5b1e40f5eea5893f4fcb01803cfdd78bd757ec93daadedb7169bf8d 2d316fff198707fae5a43e6b24d2a547ee9502fd278468846495d1b2f4ea62b1
|
||||
lib/codeql/swift/generated/decl/TypeAliasDecl.qll 041c098c276bc7369049e9a11540e99b061d50977338cceca47488f82b21694e 06deed614cbe77031fdbf3f9591780e80b9f545adec8b7831a2b5329ee49bc5f
|
||||
lib/codeql/swift/generated/decl/TypeDecl.qll 92f74709cce7e9f0f713598d3b20b730475c312957c518b8096206f8744419a2 305bda46c8bef48b7e30392698e724093ab2984ffed74cae3361f818cbf8c77a
|
||||
lib/codeql/swift/generated/decl/TypeDecl.qll f8382cfd5800b1165b11fe927b35b2406826f0d1239114376656352039249b56 0247872a700e15c9243dd36e564e93c8b2aeec9cdd26ee675eaaf01525787111
|
||||
lib/codeql/swift/generated/decl/UsingDecl.qll 3bb697961f5699ec9ed1b87511714eac4ee69f5d82e1fd8c6598f121e23a2f7b 4e72b98a84f796d3e0e556ae6b84bf7b7f08adc225dcdc00fd120461e287b472
|
||||
lib/codeql/swift/generated/decl/ValueDecl.qll d3b9c241fd6cb1ce8274435c0242775c28c08f6a47caae01ad1ecd38897b2cd5 bc81291b1394b47972d7b75b6a767ed847f881932a7d9345d28d161a55b66bd1
|
||||
lib/codeql/swift/generated/decl/VarDecl.qll 8978a73fa2d7a9f952b68a2638788eda857e62502311a33fa6de1dad49a6cb1c b8b6c8cf6773056c3a90494754b0a257dcae494c03d933f138ece7f531fb9158
|
||||
@@ -1048,13 +1048,13 @@ test/extractor-tests/generated/Diagnostics/Diagnostics.ql c1f8be2c283e13c1a4dada
|
||||
test/extractor-tests/generated/File/File.ql a1385ef2080e04e8757f61b8e1d0129df9f955edf03fbb3b83cc9cb5498b4e95 0364d8c7f108d01b2641f996efedab7084956307e875e6bc078ea677d04267e0
|
||||
test/extractor-tests/generated/KeyPathComponent/KeyPathComponent.ql 3fa617f8ed1b308d0c56f429ee8abe6d33ef60bf57d87f6dc89fdc8fe969a102 c2fa3153077dbe9e0fc608524dc03c82ff4ed460364d341ee6a817b0d75291c3
|
||||
test/extractor-tests/generated/decl/Accessor/Accessor.ql 3d4301ec9ec6284b547f8cccf94c3077f0baf70778f458bc21bebc5de55c86e5 2f263e79ecd1ac8da56c17caff400fd3c40d83b6aa3d501830f1d2eeb48a57cd
|
||||
test/extractor-tests/generated/decl/AssociatedTypeDecl/AssociatedTypeDecl.ql 55a78a6b96a17532178a39bd39aa4df23295f98019bb00de041ba15dfd4f84d9 51dbcd86203d5d031d748f77943a81c2c50de4ff559af20a4a1a682a19978d4f
|
||||
test/extractor-tests/generated/decl/AssociatedTypeDecl/AssociatedTypeDecl.ql b7ad6073733906adbffae03a0a227beea7b5ddeb46e31c81fa9c98d6688abd5c b9b9b01e358d37a154bd3e4d7e59765c5c0ef36cc1a3110718ec9d35946d1ab6
|
||||
test/extractor-tests/generated/decl/CapturedDecl/CapturedDecl.ql fd62be6c38d39f371c20e8c2f233e37a9da5aa234588920634f5db67e8beb3bd d51d35d4fd6a21cd596e064e0221d0c86e36312412a9bd4e64f431c123f3019a
|
||||
test/extractor-tests/generated/decl/ClassDecl/ClassDecl.ql d5fa7f68307e2e3e7ad060a125bda148e4a28f6acbef08a1a975bbf9ba947641 46d1e4f801414f1c869601dc706e41393e5fcd399e51da593c1e58737f6ff427
|
||||
test/extractor-tests/generated/decl/ClassDecl/ClassDecl.ql 28e453c11069b0266d950da1f32361863d10d870de0f6d11512a0bb686af2ec1 2524ee149a48902346b81bfac6f50c832f83680aed4a850e8ea15504253865be
|
||||
test/extractor-tests/generated/decl/ConcreteVarDecl/ConcreteVarDecl.ql 936ac4aa52a55bd5bb4c75c117fffcc00208b9f502ff7ee05acbaad7d48a52fb d80346fe34d40910f5ecdb33d7266b6e4d1ec79f8d767c7da5e2ab780f201457
|
||||
test/extractor-tests/generated/decl/Deinitializer/MISSING_SOURCE.txt 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d
|
||||
test/extractor-tests/generated/decl/EnumDecl/EnumCaseDecl.ql 7436bb7dfaa471f5a21ea2e3faba97d61bf53f930720999abdcc6745a65f0a1a 0241b2bb07c17136f6099185f65ea1266cd912296dfe481dce30eb9e3d1dd23f
|
||||
test/extractor-tests/generated/decl/EnumDecl/EnumDecl.ql 47f20279f49388a4850df4f5ee61634e30beed58567eff891688c09942862ec2 8e11af1ceb07cab9738ffb25ac877ced712d1883a6514de5e8895cd1809a7bd8
|
||||
test/extractor-tests/generated/decl/EnumDecl/EnumDecl.ql 329c3f6255ef3ed5441110291d40c4e409ad520d92504d8778aadf21e1359a27 ebda0c8f81c6c8383c8ecb68be66a14cc351a9b5f21d44f9a815ff8e149d74b8
|
||||
test/extractor-tests/generated/decl/EnumDecl/EnumElementDecl.ql 16caf5b014dea42a36b23eee6932c0818d94b1416e151ce46ba06a1fd2fb73ba cac704575b50613c8f8f297ce37c6d09ef943c94df4289643a4496103ac8388e
|
||||
test/extractor-tests/generated/decl/ExtensionDecl/ExtensionDecl.ql 04529ad447b7b0c529a54b0e0d009183c00cb1dcd7eb16378a7c4c7bc86bca4d 86379270a15fa014dc127607b720bb4d39b24b70d1c0f72ef8563c4144423ced
|
||||
test/extractor-tests/generated/decl/GenericTypeParamDecl/MISSING_SOURCE.txt 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d
|
||||
@@ -1064,9 +1064,9 @@ test/extractor-tests/generated/decl/InfixOperatorDecl/MISSING_SOURCE.txt 35fb32e
|
||||
test/extractor-tests/generated/decl/Initializer/MISSING_SOURCE.txt 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d
|
||||
test/extractor-tests/generated/decl/MacroDecl/MacroDecl.ql 61f092d4ed5972283b3eb0eeec81c8f299496dc548a98dca56a1aadaf8248d1d b9cd637cb0f6f34d8d0a4473f2c212a0534d49891d55593758bb03f8d225f32a
|
||||
test/extractor-tests/generated/decl/MacroDecl/MacroRole.ql 7ab0dc211663c1b09a54ccbee7d6be94ffa45f420b383d2e2f22b7ccfb8d7a48 92296b89fccf6aebe877e67796885bedd809ebb470f23f48f98b27c2922c4ba2
|
||||
test/extractor-tests/generated/decl/ModuleDecl/ModuleDecl.ql 63a41a3b393b29d19752379fe29f26fe649dad2927836e24832e07c503d092a6 927fa4056a5d7c65803f7baa1216e6bef9b3b6a223c4a2bb50f2a6a31580db6a
|
||||
test/extractor-tests/generated/decl/ModuleDecl/ModuleDecl.ql 814ec8b4d9947ff8a49e1c4726015d8a0a35b22851dd50eb516f7c91994481e8 d01548746991d765b8c508c88cfe5ff2e39b499dd177abafcd94e226e0efa016
|
||||
test/extractor-tests/generated/decl/NamedFunction/NamedFunction.ql c6be4c1314ffed2a8a91af2e08ea14ce721195ec993d18ebd4d7b90f4a60dac3 767fc36b64291ab7ecccd63bf74856983830267c992d1347236da314fca73d57
|
||||
test/extractor-tests/generated/decl/OpaqueTypeDecl/OpaqueTypeDecl.ql 85b041e1f791b40ff3d3c58c79e017cebf9ef535ea3d576984b7c093f25aa95b 9fcf314b02ac95fbd2c0e5fc95dc48c16522c74def57f5647dd5ad7e80f7c2c1
|
||||
test/extractor-tests/generated/decl/OpaqueTypeDecl/OpaqueTypeDecl.ql d764ddd50ee6faff51bee3a00349d660c32fd5548c7bda3a19866925688e96b0 e6534ba21371aef4d99a6206187d69cda77cd613606d7cb297192f21532fdcab
|
||||
test/extractor-tests/generated/decl/ParamDecl/ParamDecl.ql cc9d89731f7a5ecc2267923268e2d8046aa3f0eb9556c6a12e53b541347f45a4 6d06279172ff2c04be0f39293a2e9a9de5e41ff1efffd41a67d5a921e1afe9ea
|
||||
test/extractor-tests/generated/decl/PatternBindingDecl/MISSING_SOURCE.txt 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d
|
||||
test/extractor-tests/generated/decl/PostfixOperatorDecl/MISSING_SOURCE.txt 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d
|
||||
|
||||
7
swift/ql/lib/codeql/swift/generated/Raw.qll
generated
7
swift/ql/lib/codeql/swift/generated/Raw.qll
generated
@@ -1008,7 +1008,7 @@ module Raw {
|
||||
/**
|
||||
* Gets the name of this type declaration.
|
||||
*/
|
||||
string getName() { type_decls(this, result) }
|
||||
string getName() { type_decls(this, result, _) }
|
||||
|
||||
/**
|
||||
* Gets the `index`th inherited type of this type declaration (0-based).
|
||||
@@ -1024,6 +1024,11 @@ module Raw {
|
||||
int getNumberOfInheritedTypes() {
|
||||
result = count(int i | type_decl_inherited_types(this, i, _))
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the declared interface type of this type declaration.
|
||||
*/
|
||||
Type getDeclaredInterfaceType() { type_decls(this, _, result) }
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -61,5 +61,28 @@ module Generated {
|
||||
final int getNumberOfInheritedTypes() {
|
||||
result = count(int i | exists(this.getInheritedType(i)))
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the declared interface type of this type declaration.
|
||||
*
|
||||
* This includes nodes from the "hidden" AST. It can be overridden in subclasses to change the
|
||||
* behavior of both the `Immediate` and non-`Immediate` versions.
|
||||
*/
|
||||
Type getImmediateDeclaredInterfaceType() {
|
||||
result =
|
||||
Synth::convertTypeFromRaw(Synth::convertTypeDeclToRaw(this)
|
||||
.(Raw::TypeDecl)
|
||||
.getDeclaredInterfaceType())
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the declared interface type of this type declaration.
|
||||
*/
|
||||
final Type getDeclaredInterfaceType() {
|
||||
exists(Type immediate |
|
||||
immediate = this.getImmediateDeclaredInterfaceType() and
|
||||
result = immediate.resolve()
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
3
swift/ql/lib/swift.dbscheme
generated
3
swift/ql/lib/swift.dbscheme
generated
@@ -530,7 +530,8 @@ prefix_operator_decls( //dir=decl
|
||||
#keyset[id]
|
||||
type_decls( //dir=decl
|
||||
int id: @type_decl ref,
|
||||
string name: string ref
|
||||
string name: string ref,
|
||||
int declared_interface_type: @type_or_none ref
|
||||
);
|
||||
|
||||
#keyset[id, index]
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,4 @@
|
||||
description: Expose declared interface types
|
||||
compatibility: backwards
|
||||
type_decls.rel: run upgrade.ql new_type_decls
|
||||
unspecified_elements.rel: run upgrade.ql new_unspecified_elements
|
||||
@@ -0,0 +1,29 @@
|
||||
class TypeDecl extends @type_decl {
|
||||
string toString() { none() }
|
||||
}
|
||||
|
||||
newtype TAddedElement = TType(TypeDecl t)
|
||||
|
||||
module Fresh = QlBuiltins::NewEntity<TAddedElement>;
|
||||
|
||||
class TNewElement = @element or Fresh::EntityId;
|
||||
|
||||
class NewElement extends TNewElement {
|
||||
string toString() { none() }
|
||||
}
|
||||
|
||||
query predicate new_type_decls(TypeDecl typeDecl, string name, NewElement elementType) {
|
||||
type_decls(typeDecl, name) and
|
||||
Fresh::map(TType(typeDecl)) = elementType
|
||||
}
|
||||
|
||||
query predicate new_unspecified_elements(NewElement id, string property, string error) {
|
||||
unspecified_elements(id, property, error)
|
||||
or
|
||||
exists(TypeDecl typeDecl | type_decls(typeDecl, _) |
|
||||
id = Fresh::map(TType(typeDecl)) and
|
||||
error =
|
||||
"TypeDecl declared interface type missing after upgrade. Please update your CodeQL code." and
|
||||
property = ""
|
||||
)
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
instances
|
||||
| associated_type.swift:2:5:2:20 | Bar | getModule: | file://:0:0:0:0 | associated_type | getInterfaceType: | Self.Bar.Type | getName: | Bar |
|
||||
| associated_type.swift:3:5:3:25 | Baz | getModule: | file://:0:0:0:0 | associated_type | getInterfaceType: | Self.Baz.Type | getName: | Baz |
|
||||
| associated_type.swift:2:5:2:20 | Bar | getModule: | file://:0:0:0:0 | associated_type | getInterfaceType: | Self.Bar.Type | getName: | Bar | getDeclaredInterfaceType: | Self.Bar |
|
||||
| associated_type.swift:3:5:3:25 | Baz | getModule: | file://:0:0:0:0 | associated_type | getInterfaceType: | Self.Baz.Type | getName: | Baz | getDeclaredInterfaceType: | Self.Baz |
|
||||
getMember
|
||||
getInheritedType
|
||||
| associated_type.swift:3:5:3:25 | Baz | 0 | Equatable |
|
||||
|
||||
@@ -4,7 +4,8 @@ import TestUtils
|
||||
|
||||
query predicate instances(
|
||||
AssociatedTypeDecl x, string getModule__label, ModuleDecl getModule,
|
||||
string getInterfaceType__label, Type getInterfaceType, string getName__label, string getName
|
||||
string getInterfaceType__label, Type getInterfaceType, string getName__label, string getName,
|
||||
string getDeclaredInterfaceType__label, Type getDeclaredInterfaceType
|
||||
) {
|
||||
toBeTested(x) and
|
||||
not x.isUnknown() and
|
||||
@@ -13,7 +14,9 @@ query predicate instances(
|
||||
getInterfaceType__label = "getInterfaceType:" and
|
||||
getInterfaceType = x.getInterfaceType() and
|
||||
getName__label = "getName:" and
|
||||
getName = x.getName()
|
||||
getName = x.getName() and
|
||||
getDeclaredInterfaceType__label = "getDeclaredInterfaceType:" and
|
||||
getDeclaredInterfaceType = x.getDeclaredInterfaceType()
|
||||
}
|
||||
|
||||
query predicate getMember(AssociatedTypeDecl x, int index, Decl getMember) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
instances
|
||||
| class.swift:1:1:7:1 | Foo | getModule: | file://:0:0:0:0 | class | getInterfaceType: | Foo.Type | getName: | Foo | getType: | Foo |
|
||||
| class.swift:11:1:14:1 | Generic | getModule: | file://:0:0:0:0 | class | getInterfaceType: | Generic<X, Y>.Type | getName: | Generic | getType: | Generic |
|
||||
| class.swift:16:1:17:1 | Baz | getModule: | file://:0:0:0:0 | class | getInterfaceType: | Baz.Type | getName: | Baz | getType: | Baz |
|
||||
| class.swift:1:1:7:1 | Foo | getModule: | file://:0:0:0:0 | class | getInterfaceType: | Foo.Type | getName: | Foo | getDeclaredInterfaceType: | Foo | getType: | Foo |
|
||||
| class.swift:11:1:14:1 | Generic | getModule: | file://:0:0:0:0 | class | getInterfaceType: | Generic<X, Y>.Type | getName: | Generic | getDeclaredInterfaceType: | Generic<X, Y> | getType: | Generic |
|
||||
| class.swift:16:1:17:1 | Baz | getModule: | file://:0:0:0:0 | class | getInterfaceType: | Baz.Type | getName: | Baz | getDeclaredInterfaceType: | Baz | getType: | Baz |
|
||||
getGenericTypeParam
|
||||
| class.swift:11:1:14:1 | Generic | 0 | class.swift:11:15:11:15 | X |
|
||||
| class.swift:11:1:14:1 | Generic | 1 | class.swift:11:18:11:18 | Y |
|
||||
|
||||
@@ -4,7 +4,9 @@ import TestUtils
|
||||
|
||||
query predicate instances(
|
||||
ClassDecl x, string getModule__label, ModuleDecl getModule, string getInterfaceType__label,
|
||||
Type getInterfaceType, string getName__label, string getName, string getType__label, Type getType
|
||||
Type getInterfaceType, string getName__label, string getName,
|
||||
string getDeclaredInterfaceType__label, Type getDeclaredInterfaceType, string getType__label,
|
||||
Type getType
|
||||
) {
|
||||
toBeTested(x) and
|
||||
not x.isUnknown() and
|
||||
@@ -14,6 +16,8 @@ query predicate instances(
|
||||
getInterfaceType = x.getInterfaceType() and
|
||||
getName__label = "getName:" and
|
||||
getName = x.getName() and
|
||||
getDeclaredInterfaceType__label = "getDeclaredInterfaceType:" and
|
||||
getDeclaredInterfaceType = x.getDeclaredInterfaceType() and
|
||||
getType__label = "getType:" and
|
||||
getType = x.getType()
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
instances
|
||||
| enums.swift:1:1:4:1 | EnumValues | getModule: | file://:0:0:0:0 | enums | getInterfaceType: | EnumValues.Type | getName: | EnumValues | getType: | EnumValues |
|
||||
| enums.swift:7:1:10:1 | EnumValuesWithBase | getModule: | file://:0:0:0:0 | enums | getInterfaceType: | EnumValuesWithBase.Type | getName: | EnumValuesWithBase | getType: | EnumValuesWithBase |
|
||||
| enums.swift:12:1:16:1 | EnumWithParams | getModule: | file://:0:0:0:0 | enums | getInterfaceType: | EnumWithParams.Type | getName: | EnumWithParams | getType: | EnumWithParams |
|
||||
| enums.swift:18:1:21:1 | GenericEnum | getModule: | file://:0:0:0:0 | enums | getInterfaceType: | GenericEnum<T>.Type | getName: | GenericEnum | getType: | GenericEnum |
|
||||
| enums.swift:23:1:27:1 | EnumWithNamedParams | getModule: | file://:0:0:0:0 | enums | getInterfaceType: | EnumWithNamedParams.Type | getName: | EnumWithNamedParams | getType: | EnumWithNamedParams |
|
||||
| enums.swift:1:1:4:1 | EnumValues | getModule: | file://:0:0:0:0 | enums | getInterfaceType: | EnumValues.Type | getName: | EnumValues | getDeclaredInterfaceType: | EnumValues | getType: | EnumValues |
|
||||
| enums.swift:7:1:10:1 | EnumValuesWithBase | getModule: | file://:0:0:0:0 | enums | getInterfaceType: | EnumValuesWithBase.Type | getName: | EnumValuesWithBase | getDeclaredInterfaceType: | EnumValuesWithBase | getType: | EnumValuesWithBase |
|
||||
| enums.swift:12:1:16:1 | EnumWithParams | getModule: | file://:0:0:0:0 | enums | getInterfaceType: | EnumWithParams.Type | getName: | EnumWithParams | getDeclaredInterfaceType: | EnumWithParams | getType: | EnumWithParams |
|
||||
| enums.swift:18:1:21:1 | GenericEnum | getModule: | file://:0:0:0:0 | enums | getInterfaceType: | GenericEnum<T>.Type | getName: | GenericEnum | getDeclaredInterfaceType: | GenericEnum<T> | getType: | GenericEnum |
|
||||
| enums.swift:23:1:27:1 | EnumWithNamedParams | getModule: | file://:0:0:0:0 | enums | getInterfaceType: | EnumWithNamedParams.Type | getName: | EnumWithNamedParams | getDeclaredInterfaceType: | EnumWithNamedParams | getType: | EnumWithNamedParams |
|
||||
getGenericTypeParam
|
||||
| enums.swift:18:1:21:1 | GenericEnum | 0 | enums.swift:18:18:18:18 | T |
|
||||
getMember
|
||||
|
||||
@@ -4,7 +4,9 @@ import TestUtils
|
||||
|
||||
query predicate instances(
|
||||
EnumDecl x, string getModule__label, ModuleDecl getModule, string getInterfaceType__label,
|
||||
Type getInterfaceType, string getName__label, string getName, string getType__label, Type getType
|
||||
Type getInterfaceType, string getName__label, string getName,
|
||||
string getDeclaredInterfaceType__label, Type getDeclaredInterfaceType, string getType__label,
|
||||
Type getType
|
||||
) {
|
||||
toBeTested(x) and
|
||||
not x.isUnknown() and
|
||||
@@ -14,6 +16,8 @@ query predicate instances(
|
||||
getInterfaceType = x.getInterfaceType() and
|
||||
getName__label = "getName:" and
|
||||
getName = x.getName() and
|
||||
getDeclaredInterfaceType__label = "getDeclaredInterfaceType:" and
|
||||
getDeclaredInterfaceType = x.getDeclaredInterfaceType() and
|
||||
getType__label = "getType:" and
|
||||
getType = x.getType()
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
instances
|
||||
| file://:0:0:0:0 | Foo | getModule: | file://:0:0:0:0 | Foo | getInterfaceType: | module<Foo> | getName: | Foo | isBuiltinModule: | no | isSystemModule: | no |
|
||||
| file://:0:0:0:0 | __ObjC | getModule: | file://:0:0:0:0 | __ObjC | getInterfaceType: | module<__ObjC> | getName: | __ObjC | isBuiltinModule: | no | isSystemModule: | no |
|
||||
| file://:0:0:0:0 | default_module_name | getModule: | file://:0:0:0:0 | default_module_name | getInterfaceType: | module<default_module_name> | getName: | default_module_name | isBuiltinModule: | no | isSystemModule: | no |
|
||||
| file://:0:0:0:0 | Foo | getModule: | file://:0:0:0:0 | Foo | getInterfaceType: | module<Foo> | getName: | Foo | getDeclaredInterfaceType: | module<Foo> | isBuiltinModule: | no | isSystemModule: | no |
|
||||
| file://:0:0:0:0 | __ObjC | getModule: | file://:0:0:0:0 | __ObjC | getInterfaceType: | module<__ObjC> | getName: | __ObjC | getDeclaredInterfaceType: | module<__ObjC> | isBuiltinModule: | no | isSystemModule: | no |
|
||||
| file://:0:0:0:0 | default_module_name | getModule: | file://:0:0:0:0 | default_module_name | getInterfaceType: | module<default_module_name> | getName: | default_module_name | getDeclaredInterfaceType: | module<default_module_name> | isBuiltinModule: | no | isSystemModule: | no |
|
||||
getMember
|
||||
getInheritedType
|
||||
getAnImportedModule
|
||||
|
||||
@@ -4,8 +4,10 @@ import TestUtils
|
||||
|
||||
query predicate instances(
|
||||
ModuleDecl x, string getModule__label, ModuleDecl getModule, string getInterfaceType__label,
|
||||
Type getInterfaceType, string getName__label, string getName, string isBuiltinModule__label,
|
||||
string isBuiltinModule, string isSystemModule__label, string isSystemModule
|
||||
Type getInterfaceType, string getName__label, string getName,
|
||||
string getDeclaredInterfaceType__label, Type getDeclaredInterfaceType,
|
||||
string isBuiltinModule__label, string isBuiltinModule, string isSystemModule__label,
|
||||
string isSystemModule
|
||||
) {
|
||||
toBeTested(x) and
|
||||
not x.isUnknown() and
|
||||
@@ -15,6 +17,8 @@ query predicate instances(
|
||||
getInterfaceType = x.getInterfaceType() and
|
||||
getName__label = "getName:" and
|
||||
getName = x.getName() and
|
||||
getDeclaredInterfaceType__label = "getDeclaredInterfaceType:" and
|
||||
getDeclaredInterfaceType = x.getDeclaredInterfaceType() and
|
||||
isBuiltinModule__label = "isBuiltinModule:" and
|
||||
(if x.isBuiltinModule() then isBuiltinModule = "yes" else isBuiltinModule = "no") and
|
||||
isSystemModule__label = "isSystemModule:" and
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
instances
|
||||
| file://:0:0:0:0 | _ | getModule: | file://:0:0:0:0 | opaque_types | getInterfaceType: | (some Base).Type | getName: | _ | getNamingDeclaration: | opaque_types.swift:9:1:9:51 | baz(_:) |
|
||||
| file://:0:0:0:0 | _ | getModule: | file://:0:0:0:0 | opaque_types | getInterfaceType: | (some P).Type | getName: | _ | getNamingDeclaration: | opaque_types.swift:5:1:5:45 | bar(_:) |
|
||||
| file://:0:0:0:0 | _ | getModule: | file://:0:0:0:0 | opaque_types | getInterfaceType: | (some P).Type | getName: | _ | getNamingDeclaration: | opaque_types.swift:13:1:13:59 | bazz() |
|
||||
| file://:0:0:0:0 | _ | getModule: | file://:0:0:0:0 | opaque_types | getInterfaceType: | (some SignedInteger).Type | getName: | _ | getNamingDeclaration: | opaque_types.swift:1:1:1:45 | foo() |
|
||||
| file://:0:0:0:0 | _ | getModule: | file://:0:0:0:0 | opaque_types | getInterfaceType: | (some Base).Type | getName: | _ | getDeclaredInterfaceType: | some Base | getNamingDeclaration: | opaque_types.swift:9:1:9:51 | baz(_:) |
|
||||
| file://:0:0:0:0 | _ | getModule: | file://:0:0:0:0 | opaque_types | getInterfaceType: | (some P).Type | getName: | _ | getDeclaredInterfaceType: | some P | getNamingDeclaration: | opaque_types.swift:5:1:5:45 | bar(_:) |
|
||||
| file://:0:0:0:0 | _ | getModule: | file://:0:0:0:0 | opaque_types | getInterfaceType: | (some P).Type | getName: | _ | getDeclaredInterfaceType: | some P | getNamingDeclaration: | opaque_types.swift:13:1:13:59 | bazz() |
|
||||
| file://:0:0:0:0 | _ | getModule: | file://:0:0:0:0 | opaque_types | getInterfaceType: | (some SignedInteger).Type | getName: | _ | getDeclaredInterfaceType: | some SignedInteger | getNamingDeclaration: | opaque_types.swift:1:1:1:45 | foo() |
|
||||
getGenericTypeParam
|
||||
getMember
|
||||
getInheritedType
|
||||
|
||||
@@ -4,8 +4,9 @@ import TestUtils
|
||||
|
||||
query predicate instances(
|
||||
OpaqueTypeDecl x, string getModule__label, ModuleDecl getModule, string getInterfaceType__label,
|
||||
Type getInterfaceType, string getName__label, string getName, string getNamingDeclaration__label,
|
||||
ValueDecl getNamingDeclaration
|
||||
Type getInterfaceType, string getName__label, string getName,
|
||||
string getDeclaredInterfaceType__label, Type getDeclaredInterfaceType,
|
||||
string getNamingDeclaration__label, ValueDecl getNamingDeclaration
|
||||
) {
|
||||
toBeTested(x) and
|
||||
not x.isUnknown() and
|
||||
@@ -15,6 +16,8 @@ query predicate instances(
|
||||
getInterfaceType = x.getInterfaceType() and
|
||||
getName__label = "getName:" and
|
||||
getName = x.getName() and
|
||||
getDeclaredInterfaceType__label = "getDeclaredInterfaceType:" and
|
||||
getDeclaredInterfaceType = x.getDeclaredInterfaceType() and
|
||||
getNamingDeclaration__label = "getNamingDeclaration:" and
|
||||
getNamingDeclaration = x.getNamingDeclaration()
|
||||
}
|
||||
|
||||
@@ -278,6 +278,7 @@ class TypeDecl(ValueDecl):
|
||||
This only returns the types effectively appearing in the declaration. In particular it
|
||||
will not resolve `TypeAliasDecl`s or consider base types added by extensions.
|
||||
""")
|
||||
declared_interface_type: Type
|
||||
|
||||
class AbstractTypeParamDecl(TypeDecl):
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user