Merge pull request #10678 from tamasvajk/kotlin-type-param-modifiers

Kotlin: Extract type parameter modifiers (`reified`, `in`, `out`)
This commit is contained in:
Tamás Vajk
2022-10-18 09:10:57 +02:00
committed by GitHub
15 changed files with 5051 additions and 14 deletions

View File

@@ -137,7 +137,7 @@ abstract class BoundedType extends RefType, @boundedtype {
* For example, `T` is a type parameter in
* `class X<T> { }` and in `<T> void m() { }`.
*/
class TypeVariable extends BoundedType, @typevariable {
class TypeVariable extends BoundedType, Modifiable, @typevariable {
/** Gets the generic type that is parameterized by this type parameter, if any. */
GenericType getGenericType() { typeVars(this, _, _, _, result) }

View File

@@ -96,4 +96,13 @@ abstract class Modifiable extends Element {
/** Holds if this element has a `lateinit` modifier. */
predicate isLateinit() { this.hasModifier("lateinit") }
/** Holds if this element has a `reified` modifier. */
predicate isReified() { this.hasModifier("reified") }
/** Holds if this element has an `in` modifier. */
predicate isIn() { this.hasModifier("in") }
/** Holds if this element has an `out` modifier. */
predicate isOut() { this.hasModifier("out") }
}