Skip to content

Commit d426925

Browse files
MathiasVPgeoffw0
authored andcommitted
Swift: Add QL skeleton for aliased types.
1 parent e931d59 commit d426925

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

swift/ql/lib/codeql/swift/elements/type/Type.qll

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,13 @@ private import codeql.swift.generated.type.Type
22

33
class Type extends Generated::Type {
44
override string toString() { result = this.getName() }
5+
6+
/**
7+
* Gets this type after any type aliases have been resolved. For example in
8+
* the following code, the underlying type of `MyInt` is `Int`:
9+
* ```
10+
* typealias MyInt = Int
11+
* ```
12+
*/
13+
Type getUnderlyingType() { result = this }
514
}
Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
1-
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
1+
private import codeql.swift.elements.type.Type
22
private import codeql.swift.generated.type.TypeAliasType
33

4-
class TypeAliasType extends Generated::TypeAliasType { }
4+
class TypeAliasType extends Generated::TypeAliasType {
5+
/**
6+
* Gets the aliased type of this type alias type.
7+
*
8+
* For example the aliased type of `MyInt` in the following code is `Int`:
9+
* ```
10+
* typealias MyInt = Int
11+
* ```
12+
*/
13+
Type getAliasedType() { none() } // TODO: not yet implemented.
14+
15+
override Type getUnderlyingType() { result = this } // TODO: not yet implemented.
16+
}

0 commit comments

Comments
 (0)