mirror of
https://github.com/apple/pkl.git
synced 2026-09-06 01:47:31 +02:00
Add this as a self type (#1708)
This commit is contained in:
+2
-2
@@ -46,7 +46,7 @@ import "pkl:yaml"
|
||||
/// ```
|
||||
abstract external class Any {
|
||||
/// Returns the class of [this].
|
||||
external function getClass(): Class
|
||||
external function getClass(): Class<this>
|
||||
|
||||
/// Returns a string representation of [this].
|
||||
///
|
||||
@@ -57,7 +57,7 @@ abstract external class Any {
|
||||
///
|
||||
/// This method is the complement of the `??` operator and the equivalent of an `Option` type's
|
||||
/// `map` and `flatMap` methods.
|
||||
external function ifNonNull<Result>(transform: (NonNull) -> Result): Result?
|
||||
external function ifNonNull<Result>(transform: (this) -> Result): Result?
|
||||
}
|
||||
|
||||
/// The type of [null] and null values created with [Null()].
|
||||
|
||||
+1
-1
@@ -210,7 +210,7 @@ external class Reference<out D, out T> {
|
||||
abstract class Domain {
|
||||
/// Determines how [Reference] instances are transformed to strings by [Reference.toString()] and
|
||||
/// string interpolation.
|
||||
abstract function renderReference(reference: Reference<Domain, Any>): String
|
||||
abstract function renderReference(reference: Reference<this, Any>): String
|
||||
}
|
||||
|
||||
/// A property or subscript access as part of a [Reference]'s path.
|
||||
|
||||
@@ -107,6 +107,9 @@ const bytesType: DeclaredType = DeclaredType(Class(Bytes))
|
||||
/// A mirror for the `module` type.
|
||||
external const moduleType: ModuleType
|
||||
|
||||
/// A mirror for the `this` type.
|
||||
external const thisType: ThisType
|
||||
|
||||
/// A mirror for the `unknown` type.
|
||||
external const unknownType: UnknownType
|
||||
|
||||
@@ -431,6 +434,11 @@ external class FunctionType extends Type {
|
||||
/// [moduleType] is an instance of this class.
|
||||
class ModuleType extends Type
|
||||
|
||||
/// The `this` type.
|
||||
///
|
||||
/// [thisType] is an instance of this class.
|
||||
class ThisType extends Type
|
||||
|
||||
/// The `unknown` type.
|
||||
///
|
||||
/// [unknownType] is an instance of this class.
|
||||
|
||||
Reference in New Issue
Block a user