mirror of
https://github.com/apple/pkl.git
synced 2026-09-03 06:17:16 +02:00
Add this as a self type (#1708)
This commit is contained in:
@@ -751,6 +751,12 @@ class JavaCodeGenerator(
|
|||||||
when (this) {
|
when (this) {
|
||||||
PType.UNKNOWN -> OBJECT.nullableIf(nullable)
|
PType.UNKNOWN -> OBJECT.nullableIf(nullable)
|
||||||
PType.NOTHING -> TypeName.VOID
|
PType.NOTHING -> TypeName.VOID
|
||||||
|
PType.MODULE,
|
||||||
|
PType.THIS ->
|
||||||
|
// TODO: support self types: `class Foo<T extends Foo<T>>`
|
||||||
|
throw JavaCodeGeneratorException(
|
||||||
|
"Pkl `${this}` types are not supported by the Java code generator."
|
||||||
|
)
|
||||||
is PType.StringLiteral -> STRING.nullableIf(nullable)
|
is PType.StringLiteral -> STRING.nullableIf(nullable)
|
||||||
is PType.Class -> {
|
is PType.Class -> {
|
||||||
// if in doubt, spell it out
|
// if in doubt, spell it out
|
||||||
|
|||||||
@@ -649,6 +649,12 @@ class KotlinCodeGenerator(
|
|||||||
when (this) {
|
when (this) {
|
||||||
PType.UNKNOWN -> ANY_NULL
|
PType.UNKNOWN -> ANY_NULL
|
||||||
PType.NOTHING -> NOTHING
|
PType.NOTHING -> NOTHING
|
||||||
|
PType.MODULE,
|
||||||
|
PType.THIS ->
|
||||||
|
// TODO: support self types: `class Foo<T extends Foo<T>>`
|
||||||
|
throw KotlinCodeGeneratorException(
|
||||||
|
"Pkl `${this}` types are not supported by the Kotlin code generator."
|
||||||
|
)
|
||||||
is PType.StringLiteral -> STRING
|
is PType.StringLiteral -> STRING
|
||||||
is PType.Class -> {
|
is PType.Class -> {
|
||||||
// if in doubt, spell it out
|
// if in doubt, spell it out
|
||||||
|
|||||||
@@ -57,6 +57,17 @@ public abstract class PType implements Serializable {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** The {@code this} type. */
|
||||||
|
public static final PType THIS =
|
||||||
|
new PType() {
|
||||||
|
@Serial private static final long serialVersionUID = 0L;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "this";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
private PType() {}
|
private PType() {}
|
||||||
|
|
||||||
public List<PType> getTypeArguments() {
|
public List<PType> getTypeArguments() {
|
||||||
|
|||||||
@@ -131,6 +131,7 @@ import org.pkl.core.ast.expression.primary.GetMemberKeyNode;
|
|||||||
import org.pkl.core.ast.expression.primary.GetModuleNode;
|
import org.pkl.core.ast.expression.primary.GetModuleNode;
|
||||||
import org.pkl.core.ast.expression.primary.GetModuleOwnerNode;
|
import org.pkl.core.ast.expression.primary.GetModuleOwnerNode;
|
||||||
import org.pkl.core.ast.expression.primary.GetOwnerNode;
|
import org.pkl.core.ast.expression.primary.GetOwnerNode;
|
||||||
|
import org.pkl.core.ast.expression.primary.GetReceiverClassNode;
|
||||||
import org.pkl.core.ast.expression.primary.GetReceiverNode;
|
import org.pkl.core.ast.expression.primary.GetReceiverNode;
|
||||||
import org.pkl.core.ast.expression.primary.GetTypeAliasModuleNode;
|
import org.pkl.core.ast.expression.primary.GetTypeAliasModuleNode;
|
||||||
import org.pkl.core.ast.expression.primary.OuterNode;
|
import org.pkl.core.ast.expression.primary.OuterNode;
|
||||||
@@ -208,6 +209,7 @@ import org.pkl.core.stdlib.registry.ExternalMemberRegistry;
|
|||||||
import org.pkl.core.stdlib.registry.MemberRegistryFactory;
|
import org.pkl.core.stdlib.registry.MemberRegistryFactory;
|
||||||
import org.pkl.core.util.CollectionUtils;
|
import org.pkl.core.util.CollectionUtils;
|
||||||
import org.pkl.core.util.EconomicMaps;
|
import org.pkl.core.util.EconomicMaps;
|
||||||
|
import org.pkl.core.util.ErrorMessages;
|
||||||
import org.pkl.core.util.IoUtils;
|
import org.pkl.core.util.IoUtils;
|
||||||
import org.pkl.core.util.Pair;
|
import org.pkl.core.util.Pair;
|
||||||
import org.pkl.parser.Span;
|
import org.pkl.parser.Span;
|
||||||
@@ -279,6 +281,7 @@ import org.pkl.parser.syntax.Type.NothingType;
|
|||||||
import org.pkl.parser.syntax.Type.NullableType;
|
import org.pkl.parser.syntax.Type.NullableType;
|
||||||
import org.pkl.parser.syntax.Type.ParenthesizedType;
|
import org.pkl.parser.syntax.Type.ParenthesizedType;
|
||||||
import org.pkl.parser.syntax.Type.StringConstantType;
|
import org.pkl.parser.syntax.Type.StringConstantType;
|
||||||
|
import org.pkl.parser.syntax.Type.ThisType;
|
||||||
import org.pkl.parser.syntax.Type.UnionType;
|
import org.pkl.parser.syntax.Type.UnionType;
|
||||||
import org.pkl.parser.syntax.Type.UnknownType;
|
import org.pkl.parser.syntax.Type.UnknownType;
|
||||||
import org.pkl.parser.syntax.TypeAlias;
|
import org.pkl.parser.syntax.TypeAlias;
|
||||||
@@ -370,7 +373,105 @@ public class AstBuilder extends AbstractAstBuilder<Object> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UnresolvedTypeNode visitModuleType(ModuleType type) {
|
public UnresolvedTypeNode visitModuleType(ModuleType type) {
|
||||||
return new UnresolvedTypeNode.Module(createSourceSection(type));
|
var sourceSection = createSourceSection(type);
|
||||||
|
checkModuleType(type, sourceSection);
|
||||||
|
return new UnresolvedTypeNode.Module(sourceSection);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkModuleType(ModuleType type, SourceSection sourceSection) {
|
||||||
|
// `class X extends module` is fine
|
||||||
|
if (type.parent() instanceof Class classNode && classNode.getSuperClass() == type) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var currentScope = symbolTable.getCurrentScope();
|
||||||
|
if (!currentScope.getConstLevel().isConst()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String errorMessage = null;
|
||||||
|
// only classes/typealiases/annotations will apply "MODULE" const level
|
||||||
|
if (currentScope.getConstLevel() == ConstLevel.MODULE) {
|
||||||
|
for (var scope = currentScope; scope != null; scope = scope.getParent()) {
|
||||||
|
if (scope.isAnnotationScope()) {
|
||||||
|
errorMessage = ErrorMessages.create("invalidModuleTypeInAnnotation");
|
||||||
|
break;
|
||||||
|
} else if (scope.isClassScope()) {
|
||||||
|
errorMessage = ErrorMessages.create("invalidModuleTypeInClass");
|
||||||
|
break;
|
||||||
|
} else if (scope.isTypeAliasScope()) {
|
||||||
|
errorMessage = ErrorMessages.create("invalidModuleTypeInTypeAlias");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Only properties and methods will apply "ALL" const level
|
||||||
|
else {
|
||||||
|
for (var scope = currentScope; scope != null; scope = scope.getParent()) {
|
||||||
|
if (scope.isPropertyScope() || scope.isMethodScope()) {
|
||||||
|
var parentScope = scope.getParent();
|
||||||
|
assert parentScope != null;
|
||||||
|
// if the parent also has "ALL", we haven't found the originating const property/method
|
||||||
|
// yet.
|
||||||
|
if (parentScope.getConstLevel() == ConstLevel.ALL) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
var message =
|
||||||
|
scope.isPropertyScope() ? "invalidModuleTypeInProperty" : "invalidModuleTypeInMethod";
|
||||||
|
errorMessage = ErrorMessages.create(message, scope.getQualifiedName());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
assert errorMessage != null;
|
||||||
|
// TODO: when making this an error, update comment on moduleClass in ReferenceTypeNode.eval
|
||||||
|
VmContext.get(null)
|
||||||
|
.getLogger()
|
||||||
|
.warn(
|
||||||
|
errorMessage + " This will be an error in a future release.",
|
||||||
|
VmUtils.createStackFrame(sourceSection, null));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UnresolvedTypeNode visitThisType(ThisType type) {
|
||||||
|
var sourceSection = createSourceSection(type);
|
||||||
|
// need to pass explicit class name for property and method arg/return type annotations.
|
||||||
|
// this is because type annotations on class properties/methods are initialized when the
|
||||||
|
// ClassNode
|
||||||
|
// is executed, and the frame's receiver is the enclosing module rather than the class.
|
||||||
|
// do not need: when in any object or at the module level (where `this` is the receiver's class)
|
||||||
|
org.pkl.core.runtime.Identifier className = null;
|
||||||
|
for (var scope = symbolTable.getCurrentScope(); scope != null; scope = scope.getParent()) {
|
||||||
|
if (scope.isObjectScope() || scope.isCustomThisScope()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (scope instanceof ClassScope foundClassScope) {
|
||||||
|
className = foundClassScope.getName();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// it's still safe to break on ObjectScope because this is valid:
|
||||||
|
// typealias Foo = List(any((it) -> it == new Dynamic { it is this })) // this == Dynamic
|
||||||
|
if (scope.isTypeAliasScope()) {
|
||||||
|
throw exceptionBuilder()
|
||||||
|
.withSourceSection(sourceSection)
|
||||||
|
.evalError("invalidThisTypeInTypeAlias")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ExpressionNode getClassNode;
|
||||||
|
if (isBaseModule && className != null) {
|
||||||
|
getClassNode = new GetBaseModuleClassNode(className);
|
||||||
|
} else if (className == null) {
|
||||||
|
getClassNode = new GetReceiverClassNode(sourceSection);
|
||||||
|
} else if (className.isLocalProp()) {
|
||||||
|
getClassNode =
|
||||||
|
new ReadQualifiedLocalPropertyNode(
|
||||||
|
sourceSection, className, false, new GetModuleNode(sourceSection));
|
||||||
|
} else {
|
||||||
|
getClassNode =
|
||||||
|
ReadPropertyNodeGen.create(
|
||||||
|
sourceSection, className, false, new GetModuleNode(sourceSection));
|
||||||
|
}
|
||||||
|
return new UnresolvedTypeNode.This(sourceSection, getClassNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -410,6 +410,18 @@ public final class SymbolTable {
|
|||||||
return curr;
|
return curr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final boolean isAnnotationScope() {
|
||||||
|
return this instanceof AnnotationScope;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final boolean isPropertyScope() {
|
||||||
|
return this instanceof PropertyScope;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final boolean isMethodScope() {
|
||||||
|
return this instanceof MethodScope;
|
||||||
|
}
|
||||||
|
|
||||||
public final boolean isLetScope() {
|
public final boolean isLetScope() {
|
||||||
return this instanceof LetExpressionScope;
|
return this instanceof LetExpressionScope;
|
||||||
}
|
}
|
||||||
@@ -422,6 +434,10 @@ public final class SymbolTable {
|
|||||||
return this instanceof ClassScope;
|
return this instanceof ClassScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final boolean isObjectScope() {
|
||||||
|
return this instanceof ObjectScope;
|
||||||
|
}
|
||||||
|
|
||||||
public final boolean isClassMemberScope() {
|
public final boolean isClassMemberScope() {
|
||||||
var effectiveScope = skipLambdaAndLetScopes();
|
var effectiveScope = skipLambdaAndLetScopes();
|
||||||
var parent = effectiveScope.parent;
|
var parent = effectiveScope.parent;
|
||||||
@@ -454,6 +470,10 @@ public final class SymbolTable {
|
|||||||
return this instanceof ForGeneratorScope;
|
return this instanceof ForGeneratorScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final boolean isTypeAliasScope() {
|
||||||
|
return this instanceof TypeAliasScope;
|
||||||
|
}
|
||||||
|
|
||||||
public ConstLevel getConstLevel() {
|
public ConstLevel getConstLevel() {
|
||||||
return constLevel;
|
return constLevel;
|
||||||
}
|
}
|
||||||
@@ -1010,7 +1030,6 @@ public final class SymbolTable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @Nullable VariableResolution doResolveProperty(String name, int levelsUp) {
|
public @Nullable VariableResolution doResolveProperty(String name, int levelsUp) {
|
||||||
|
|
||||||
var member = properties.get(name);
|
var member = properties.get(name);
|
||||||
if (member == null) return null;
|
if (member == null) return null;
|
||||||
return new LexicalProperty(false, member.modifiers, levelsUp);
|
return new LexicalProperty(false, member.modifiers, levelsUp);
|
||||||
@@ -1018,7 +1037,6 @@ public final class SymbolTable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @Nullable MethodResolution doResolveMethod(String name, int levelsUp) {
|
public @Nullable MethodResolution doResolveMethod(String name, int levelsUp) {
|
||||||
|
|
||||||
var member = methods.get(name);
|
var member = methods.get(name);
|
||||||
if (member == null) return null;
|
if (member == null) return null;
|
||||||
return new LexicalMethod(false, isClosed, false, member.modifiers, levelsUp);
|
return new LexicalMethod(false, isClosed, false, member.modifiers, levelsUp);
|
||||||
|
|||||||
@@ -25,6 +25,9 @@ import org.pkl.core.runtime.VmUtils;
|
|||||||
@NodeInfo(shortName = "module")
|
@NodeInfo(shortName = "module")
|
||||||
public final class GetModuleNode extends ExpressionNode {
|
public final class GetModuleNode extends ExpressionNode {
|
||||||
|
|
||||||
|
// NB: When used in an open module, this may resolve to instances of a regular class that extends
|
||||||
|
// the module.
|
||||||
|
|
||||||
public GetModuleNode(SourceSection sourceSection) {
|
public GetModuleNode(SourceSection sourceSection) {
|
||||||
super(sourceSection);
|
super(sourceSection);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.pkl.core.ast.expression.primary;
|
||||||
|
|
||||||
|
import com.oracle.truffle.api.frame.VirtualFrame;
|
||||||
|
import com.oracle.truffle.api.source.SourceSection;
|
||||||
|
import org.pkl.core.ast.ExpressionNode;
|
||||||
|
import org.pkl.core.runtime.VmUtils;
|
||||||
|
|
||||||
|
public final class GetReceiverClassNode extends ExpressionNode {
|
||||||
|
|
||||||
|
public GetReceiverClassNode(SourceSection sourceSection) {
|
||||||
|
super(sourceSection);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object executeGeneric(VirtualFrame frame) {
|
||||||
|
return VmUtils.getClass(VmUtils.getReceiver(frame));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -58,8 +58,8 @@ public final class GetParentForTypeNode extends ExpressionNode {
|
|||||||
var defaultValue =
|
var defaultValue =
|
||||||
typeNode.createDefaultValue(frame, VmLanguage.get(this), sourceSection, qualifiedName);
|
typeNode.createDefaultValue(frame, VmLanguage.get(this), sourceSection, qualifiedName);
|
||||||
|
|
||||||
// can't cache default value for `module` type in a non-final module because it's a self-type
|
// can't cache default value for `module`/`this` types in a non-final modules/classes because
|
||||||
// (the default value changes when inherited).
|
// they're self types (the default value changes when inherited).
|
||||||
if (typeNode.isFinalType() && defaultValue != null) {
|
if (typeNode.isFinalType() && defaultValue != null) {
|
||||||
unresolvedTypeNode = null;
|
unresolvedTypeNode = null;
|
||||||
this.defaultValue = defaultValue;
|
this.defaultValue = defaultValue;
|
||||||
|
|||||||
@@ -46,6 +46,8 @@ import org.pkl.core.TypeParameter;
|
|||||||
import org.pkl.core.ast.*;
|
import org.pkl.core.ast.*;
|
||||||
import org.pkl.core.ast.builder.SymbolTable.CustomThisScope;
|
import org.pkl.core.ast.builder.SymbolTable.CustomThisScope;
|
||||||
import org.pkl.core.ast.expression.primary.GetModuleNode;
|
import org.pkl.core.ast.expression.primary.GetModuleNode;
|
||||||
|
import org.pkl.core.ast.expression.primary.GetReceiverClassNode;
|
||||||
|
import org.pkl.core.ast.expression.primary.GetReceiverNode;
|
||||||
import org.pkl.core.ast.frame.WriteFrameSlotNode;
|
import org.pkl.core.ast.frame.WriteFrameSlotNode;
|
||||||
import org.pkl.core.ast.frame.WriteFrameSlotNodeGen;
|
import org.pkl.core.ast.frame.WriteFrameSlotNodeGen;
|
||||||
import org.pkl.core.ast.internal.SyntheticNode;
|
import org.pkl.core.ast.internal.SyntheticNode;
|
||||||
@@ -54,6 +56,7 @@ import org.pkl.core.ast.member.ListingOrMappingTypeCastNode;
|
|||||||
import org.pkl.core.ast.member.ObjectMember;
|
import org.pkl.core.ast.member.ObjectMember;
|
||||||
import org.pkl.core.ast.member.UntypedObjectMemberNode;
|
import org.pkl.core.ast.member.UntypedObjectMemberNode;
|
||||||
import org.pkl.core.runtime.*;
|
import org.pkl.core.runtime.*;
|
||||||
|
import org.pkl.core.stdlib.VmObjectFactory;
|
||||||
import org.pkl.core.util.EconomicMaps;
|
import org.pkl.core.util.EconomicMaps;
|
||||||
import org.pkl.core.util.EconomicSets;
|
import org.pkl.core.util.EconomicSets;
|
||||||
import org.pkl.core.util.LateInit;
|
import org.pkl.core.util.LateInit;
|
||||||
@@ -144,7 +147,7 @@ public abstract class TypeNode extends PklNode {
|
|||||||
true,
|
true,
|
||||||
typeNode -> {
|
typeNode -> {
|
||||||
// assumption: don't need to worry about `NonFinalClassTypeNode`
|
// assumption: don't need to worry about `NonFinalClassTypeNode`
|
||||||
if (typeNode instanceof NonFinalModuleTypeNode) {
|
if (typeNode instanceof NonFinalSelfTypeNode) {
|
||||||
ret.set(false);
|
ret.set(false);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -411,43 +414,61 @@ public abstract class TypeNode extends PklNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The `module` type for a final module. */
|
/** The `module` or `this` type for a final module or class. */
|
||||||
public static final class FinalModuleTypeNode extends ObjectSlotTypeNode {
|
public static final class FinalSelfTypeNode extends ObjectSlotTypeNode {
|
||||||
private final VmClass moduleClass;
|
private final VmClass clazz;
|
||||||
|
private final PType pType;
|
||||||
|
private final VmObjectFactory<Void> mirrorFactory;
|
||||||
|
|
||||||
public FinalModuleTypeNode(SourceSection sourceSection, VmClass moduleClass) {
|
private FinalSelfTypeNode(
|
||||||
|
SourceSection sourceSection,
|
||||||
|
VmClass clazz,
|
||||||
|
PType pType,
|
||||||
|
VmObjectFactory<Void> mirrorFactory) {
|
||||||
super(sourceSection);
|
super(sourceSection);
|
||||||
this.moduleClass = moduleClass;
|
this.clazz = clazz;
|
||||||
|
this.pType = pType;
|
||||||
|
this.mirrorFactory = mirrorFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static FinalSelfTypeNode moduleType(SourceSection sourceSection, VmClass clazz) {
|
||||||
|
return new FinalSelfTypeNode(
|
||||||
|
sourceSection, clazz, PType.MODULE, MirrorFactories.moduleTypeFactory);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static FinalSelfTypeNode thisType(SourceSection sourceSection, VmClass clazz) {
|
||||||
|
return new FinalSelfTypeNode(
|
||||||
|
sourceSection, clazz, PType.THIS, MirrorFactories.thisTypeFactory);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Object executeLazily(VirtualFrame frame, Object value) {
|
protected Object executeLazily(VirtualFrame frame, Object value) {
|
||||||
if (value instanceof VmTyped typed && typed.getVmClass() == moduleClass) return value;
|
if (VmUtils.getClass(value) == clazz) return value;
|
||||||
|
|
||||||
throw typeMismatch(value, moduleClass);
|
throw typeMismatch(value, clazz);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VmTyped getMirror() {
|
public VmTyped getMirror() {
|
||||||
return MirrorFactories.moduleTypeFactory.create(null);
|
return mirrorFactory.create(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean doIsEquivalentTo(TypeNode other) {
|
public boolean doIsEquivalentTo(TypeNode other) {
|
||||||
if (!(other instanceof FinalModuleTypeNode finalModuleTypeNode)) {
|
if (!(other instanceof FinalSelfTypeNode finalSelfTypeNode)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return moduleClass.equals(finalModuleTypeNode.moduleClass);
|
return clazz.equals(finalSelfTypeNode.clazz);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected PType doExport() {
|
protected PType doExport() {
|
||||||
return PType.MODULE;
|
return pType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VmClass getVmClass() {
|
public VmClass getVmClass() {
|
||||||
return moduleClass;
|
return clazz;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -461,54 +482,77 @@ public abstract class TypeNode extends PklNode {
|
|||||||
VmLanguage language,
|
VmLanguage language,
|
||||||
SourceSection headerSection,
|
SourceSection headerSection,
|
||||||
String qualifiedName) {
|
String qualifiedName) {
|
||||||
return TypeNode.createDefaultValue(moduleClass);
|
return TypeNode.createDefaultValue(clazz);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The `module` type for an open module. */
|
/** The `module` or `this` type for an open module or class. */
|
||||||
public static final class NonFinalModuleTypeNode extends ObjectSlotTypeNode {
|
public static final class NonFinalSelfTypeNode extends ObjectSlotTypeNode {
|
||||||
private final VmClass moduleClass; // only used by getVmClass()
|
private final VmClass clazz; // only used by getVmClass()
|
||||||
@Child private ExpressionNode getModuleNode;
|
@Child private ExpressionNode getTargetNode;
|
||||||
|
private final PType pType;
|
||||||
|
private final VmObjectFactory<Void> mirrorFactory;
|
||||||
|
|
||||||
public NonFinalModuleTypeNode(SourceSection sourceSection, VmClass moduleClass) {
|
private NonFinalSelfTypeNode(
|
||||||
|
SourceSection sourceSection,
|
||||||
|
VmClass clazz,
|
||||||
|
ExpressionNode getTargetNode,
|
||||||
|
PType pType,
|
||||||
|
VmObjectFactory<Void> mirrorFactory) {
|
||||||
super(sourceSection);
|
super(sourceSection);
|
||||||
this.moduleClass = moduleClass;
|
this.clazz = clazz;
|
||||||
getModuleNode = new GetModuleNode(sourceSection);
|
this.getTargetNode = getTargetNode;
|
||||||
|
this.pType = pType;
|
||||||
|
this.mirrorFactory = mirrorFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static NonFinalSelfTypeNode moduleType(SourceSection sourceSection, VmClass clazz) {
|
||||||
|
return new NonFinalSelfTypeNode(
|
||||||
|
sourceSection,
|
||||||
|
clazz,
|
||||||
|
new GetModuleNode(sourceSection),
|
||||||
|
PType.MODULE,
|
||||||
|
MirrorFactories.moduleTypeFactory);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static NonFinalSelfTypeNode thisType(SourceSection sourceSection, VmClass clazz) {
|
||||||
|
return new NonFinalSelfTypeNode(
|
||||||
|
sourceSection, clazz, new GetReceiverNode(), PType.THIS, MirrorFactories.thisTypeFactory);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Object executeLazily(VirtualFrame frame, Object value) {
|
protected Object executeLazily(VirtualFrame frame, Object value) {
|
||||||
var moduleClass = ((VmTyped) getModuleNode.executeGeneric(frame)).getVmClass();
|
var clazz = ((VmObjectLike) getTargetNode.executeGeneric(frame)).getVmClass();
|
||||||
|
|
||||||
if (value instanceof VmTyped typed) {
|
if (value instanceof VmTyped typed) {
|
||||||
var valueClass = typed.getVmClass();
|
var valueClass = typed.getVmClass();
|
||||||
if (moduleClass.isSuperclassOf(valueClass)) return value;
|
if (clazz.isSuperclassOf(valueClass)) return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw typeMismatch(value, moduleClass);
|
throw typeMismatch(value, clazz);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VmTyped getMirror() {
|
public VmTyped getMirror() {
|
||||||
return MirrorFactories.moduleTypeFactory.create(null);
|
return mirrorFactory.create(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean doIsEquivalentTo(TypeNode other) {
|
public boolean doIsEquivalentTo(TypeNode other) {
|
||||||
if (!(other instanceof NonFinalModuleTypeNode nonFinalModuleTypeNode)) {
|
if (!(other instanceof NonFinalSelfTypeNode nonFinalSelfTypeNode)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return moduleClass.equals(nonFinalModuleTypeNode.moduleClass);
|
return clazz.equals(nonFinalSelfTypeNode.clazz);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected PType doExport() {
|
protected PType doExport() {
|
||||||
return PType.MODULE;
|
return pType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VmClass getVmClass() {
|
public VmClass getVmClass() {
|
||||||
return moduleClass;
|
return clazz;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -522,8 +566,8 @@ public abstract class TypeNode extends PklNode {
|
|||||||
VmLanguage language,
|
VmLanguage language,
|
||||||
SourceSection headerSection,
|
SourceSection headerSection,
|
||||||
String qualifiedName) {
|
String qualifiedName) {
|
||||||
var moduleClass = ((VmTyped) getModuleNode.executeGeneric(frame)).getVmClass();
|
var clazz = ((VmObjectLike) getTargetNode.executeGeneric(frame)).getVmClass();
|
||||||
return TypeNode.createDefaultValue(moduleClass);
|
return TypeNode.createDefaultValue(clazz);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1954,7 +1998,7 @@ public abstract class TypeNode extends PklNode {
|
|||||||
protected final PType doExport() {
|
protected final PType doExport() {
|
||||||
var parameterTypes =
|
var parameterTypes =
|
||||||
Arrays.stream(parameterTypeNodes).map(TypeNode::export).collect(Collectors.toList());
|
Arrays.stream(parameterTypeNodes).map(TypeNode::export).collect(Collectors.toList());
|
||||||
return new PType.Function(parameterTypes, TypeNode.export(returnTypeNode));
|
return new PType.Function(parameterTypes, returnTypeNode.doExport());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -2005,8 +2049,7 @@ public abstract class TypeNode extends PklNode {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected final PType doExport() {
|
protected final PType doExport() {
|
||||||
return new PType.Class(
|
return new PType.Class(BaseModule.getFunctionClass().export(), typeArgumentNode.doExport());
|
||||||
BaseModule.getFunctionClass().export(), TypeNode.export(typeArgumentNode));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Specialization
|
@Specialization
|
||||||
@@ -2119,6 +2162,7 @@ public abstract class TypeNode extends PklNode {
|
|||||||
public abstract static class ReferenceTypeNode extends ValidatingObjectSlotTypeNode {
|
public abstract static class ReferenceTypeNode extends ValidatingObjectSlotTypeNode {
|
||||||
@Child private TypeNode domainTypeNode;
|
@Child private TypeNode domainTypeNode;
|
||||||
@Child private TypeNode referentTypeNode;
|
@Child private TypeNode referentTypeNode;
|
||||||
|
@Child private ExpressionNode getReceiverClassNode;
|
||||||
@Child private ExpressionNode getModuleNode;
|
@Child private ExpressionNode getModuleNode;
|
||||||
|
|
||||||
public ReferenceTypeNode(
|
public ReferenceTypeNode(
|
||||||
@@ -2126,6 +2170,7 @@ public abstract class TypeNode extends PklNode {
|
|||||||
super(sourceSection);
|
super(sourceSection);
|
||||||
this.domainTypeNode = domainTypeNode;
|
this.domainTypeNode = domainTypeNode;
|
||||||
this.referentTypeNode = referentTypeNode;
|
this.referentTypeNode = referentTypeNode;
|
||||||
|
this.getReceiverClassNode = new GetReceiverClassNode(sourceSection);
|
||||||
this.getModuleNode = new GetModuleNode(sourceSection);
|
this.getModuleNode = new GetModuleNode(sourceSection);
|
||||||
validate();
|
validate();
|
||||||
}
|
}
|
||||||
@@ -2168,25 +2213,30 @@ public abstract class TypeNode extends PklNode {
|
|||||||
} catch (VmTypeMismatchException e) {
|
} catch (VmTypeMismatchException e) {
|
||||||
CompilerDirectives.transferToInterpreter();
|
CompilerDirectives.transferToInterpreter();
|
||||||
throw new VmTypeMismatchException.Reference(
|
throw new VmTypeMismatchException.Reference(
|
||||||
sourceSection,
|
sourceSection, value, domainTypeNode.doExport(), referentTypeNode.doExport());
|
||||||
value,
|
|
||||||
TypeNode.export(domainTypeNode),
|
|
||||||
TypeNode.export(referentTypeNode));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var module = (VmTyped) getModuleNode.executeGeneric(frame);
|
// NB: this is correct because the `this` type is not allowed in typealias bodies.
|
||||||
return doEval(value, module);
|
// So `this` can only correspond to the receiver where the type check/annotation is written.
|
||||||
|
var thisClass = ((VmClass) getReceiverClassNode.executeGeneric(frame));
|
||||||
|
|
||||||
|
// NB: This will be wrong for deprecated usage of the `module` type in typealias bodies.
|
||||||
|
// It will always resolve to the module where the type check/annotation is written
|
||||||
|
// not the type itself. This is no _more_ broken than it was before.
|
||||||
|
var moduleClass = VmUtils.getClass(getModuleNode.executeGeneric(frame));
|
||||||
|
|
||||||
|
return doEval(value, thisClass, moduleClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TruffleBoundary
|
@TruffleBoundary
|
||||||
private Object doEval(VmReference value, VmTyped module) {
|
private Object doEval(VmReference value, VmClass thisClass, VmClass moduleClass) {
|
||||||
var referentType = TypeNode.export(referentTypeNode);
|
var referentType = referentTypeNode.doExport();
|
||||||
if (value.referentTypeIsSubtypeOf(referentType, module.getVmClass().export())) {
|
if (value.referentTypeIsSubtypeOf(referentType, thisClass.export(), moduleClass.export())) {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new VmTypeMismatchException.Reference(
|
throw new VmTypeMismatchException.Reference(
|
||||||
sourceSection, value, TypeNode.export(domainTypeNode), referentType);
|
sourceSection, value, domainTypeNode.doExport(), referentType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Fallback
|
@Fallback
|
||||||
@@ -2739,6 +2789,7 @@ public abstract class TypeNode extends PklNode {
|
|||||||
return aliasedTypeNode.executeLazily(frame, value);
|
return aliasedTypeNode.executeLazily(frame, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** See docstring on {@link TypeAliasTypeNode#executeLazily}. */
|
||||||
@Override
|
@Override
|
||||||
public Object executeEagerly(VirtualFrame frame, Object value) {
|
public Object executeEagerly(VirtualFrame frame, Object value) {
|
||||||
return aliasedTypeNode.executeEagerly(frame, value);
|
return aliasedTypeNode.executeEagerly(frame, value);
|
||||||
@@ -3334,6 +3385,7 @@ public abstract class TypeNode extends PklNode {
|
|||||||
if (clazz.isInstantiable()) {
|
if (clazz.isInstantiable()) {
|
||||||
if (clazz.isListingClass()) return VmListing.empty();
|
if (clazz.isListingClass()) return VmListing.empty();
|
||||||
if (clazz.isMappingClass()) return VmMapping.empty();
|
if (clazz.isMappingClass()) return VmMapping.empty();
|
||||||
|
if (clazz.isDynamicClass()) return VmDynamic.empty();
|
||||||
return clazz.getPrototype();
|
return clazz.getPrototype();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -103,8 +103,28 @@ public abstract class UnresolvedTypeNode extends PklNode {
|
|||||||
var module = (VmTyped) getModuleNode.executeGeneric(frame);
|
var module = (VmTyped) getModuleNode.executeGeneric(frame);
|
||||||
var moduleClass = module.getVmClass();
|
var moduleClass = module.getVmClass();
|
||||||
return moduleClass.isClosed()
|
return moduleClass.isClosed()
|
||||||
? new FinalModuleTypeNode(sourceSection, moduleClass)
|
? FinalSelfTypeNode.moduleType(sourceSection, moduleClass)
|
||||||
: new NonFinalModuleTypeNode(sourceSection, moduleClass);
|
: NonFinalSelfTypeNode.moduleType(sourceSection, moduleClass);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The `this` type. */
|
||||||
|
public static final class This extends UnresolvedTypeNode {
|
||||||
|
@Child private ExpressionNode getClassNode;
|
||||||
|
|
||||||
|
public This(SourceSection sourceSection, ExpressionNode getClassNode) {
|
||||||
|
super(sourceSection);
|
||||||
|
this.getClassNode = getClassNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TypeNode execute(VirtualFrame frame) {
|
||||||
|
CompilerDirectives.transferToInterpreter();
|
||||||
|
|
||||||
|
var clazz = (VmClass) getClassNode.executeGeneric(frame);
|
||||||
|
return clazz.isClosed()
|
||||||
|
? FinalSelfTypeNode.thisType(sourceSection, clazz)
|
||||||
|
: NonFinalSelfTypeNode.thisType(sourceSection, clazz);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -97,6 +97,9 @@ public final class MirrorFactories {
|
|||||||
public static final VmObjectFactory<Void> moduleTypeFactory =
|
public static final VmObjectFactory<Void> moduleTypeFactory =
|
||||||
new VmObjectFactory<>(ReflectModule::getModuleTypeClass);
|
new VmObjectFactory<>(ReflectModule::getModuleTypeClass);
|
||||||
|
|
||||||
|
public static final VmObjectFactory<Void> thisTypeFactory =
|
||||||
|
new VmObjectFactory<>(ReflectModule::getThisTypeClass);
|
||||||
|
|
||||||
public static final VmObjectFactory<Void> unknownTypeFactory =
|
public static final VmObjectFactory<Void> unknownTypeFactory =
|
||||||
new VmObjectFactory<>(ReflectModule::getUnknownTypeClass);
|
new VmObjectFactory<>(ReflectModule::getUnknownTypeClass);
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
|
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -84,6 +84,10 @@ public final class ReflectModule extends StdLibModule {
|
|||||||
return ModuleTypeClass.instance;
|
return ModuleTypeClass.instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static VmClass getThisTypeClass() {
|
||||||
|
return ThisTypeClass.instance;
|
||||||
|
}
|
||||||
|
|
||||||
public static VmClass getFunctionTypeClass() {
|
public static VmClass getFunctionTypeClass() {
|
||||||
return FunctionTypeClass.instance;
|
return FunctionTypeClass.instance;
|
||||||
}
|
}
|
||||||
@@ -152,6 +156,10 @@ public final class ReflectModule extends StdLibModule {
|
|||||||
static final VmClass instance = loadClass("ModuleType");
|
static final VmClass instance = loadClass("ModuleType");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final class ThisTypeClass {
|
||||||
|
static final VmClass instance = loadClass("ThisType");
|
||||||
|
}
|
||||||
|
|
||||||
private static final class FunctionTypeClass {
|
private static final class FunctionTypeClass {
|
||||||
static final VmClass instance = loadClass("FunctionType");
|
static final VmClass instance = loadClass("FunctionType");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,11 +57,7 @@ public final class VmReference extends VmValue {
|
|||||||
|
|
||||||
@TruffleBoundary
|
@TruffleBoundary
|
||||||
public VmReference(VmTyped domain, VmClass clazz, Object data) {
|
public VmReference(VmTyped domain, VmClass clazz, Object data) {
|
||||||
this(
|
this(domain, data, RrbTree.empty(), normalizeTypes(new PType.Class(clazz.export())));
|
||||||
domain,
|
|
||||||
data,
|
|
||||||
RrbTree.empty(),
|
|
||||||
normalizeTypes(new PType.Class(clazz.export()), clazz.getModule().getVmClass().export()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public VmReference(VmTyped domain, Object data, ImRrbt<VmTyped> path, PType referentType) {
|
public VmReference(VmTyped domain, Object data, ImRrbt<VmTyped> path, PType referentType) {
|
||||||
@@ -92,14 +88,18 @@ public final class VmReference extends VmValue {
|
|||||||
// * transforming T? into T|Null
|
// * transforming T? into T|Null
|
||||||
// * dereferencing aliases (except for well-known stdlib alias types)
|
// * dereferencing aliases (except for well-known stdlib alias types)
|
||||||
// * flattening unions
|
// * flattening unions
|
||||||
// * when moduleClass is supplied, replace PType.MODULE with appropriate PType.Class
|
|
||||||
// * drop PType.Function and PType.TypeVariable
|
// * drop PType.Function and PType.TypeVariable
|
||||||
private static PType normalizeTypes(PType type, PClass moduleClass) {
|
private static PType normalizeTypes(
|
||||||
|
PType type, @Nullable PType thisClass, @Nullable PType moduleClass) {
|
||||||
var types = new HashSet<PType>();
|
var types = new HashSet<PType>();
|
||||||
normalizeTypes(type, moduleClass, types);
|
normalizeTypes(type, types, thisClass, moduleClass);
|
||||||
return minimizeTypes(types);
|
return minimizeTypes(types);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static PType normalizeTypes(PType type) {
|
||||||
|
return normalizeTypes(type, null, null);
|
||||||
|
}
|
||||||
|
|
||||||
private static PType minimizeTypes(Set<PType> types) {
|
private static PType minimizeTypes(Set<PType> types) {
|
||||||
if (types.size() == 1) return types.iterator().next();
|
if (types.size() == 1) return types.iterator().next();
|
||||||
// optimization: unknown allows all references, erase all candidates to only unknown
|
// optimization: unknown allows all references, erase all candidates to only unknown
|
||||||
@@ -112,7 +112,8 @@ public final class VmReference extends VmValue {
|
|||||||
return new PType.Union(typesList);
|
return new PType.Union(typesList);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void normalizeTypes(PType type, PClass moduleClass, Set<PType> result) {
|
private static void normalizeTypes(
|
||||||
|
PType type, Set<PType> result, @Nullable PType thisClass, @Nullable PType moduleClass) {
|
||||||
if (type == PType.UNKNOWN || type == PType.NOTHING || type instanceof PType.StringLiteral) {
|
if (type == PType.UNKNOWN || type == PType.NOTHING || type instanceof PType.StringLiteral) {
|
||||||
result.add(type);
|
result.add(type);
|
||||||
} else if (type instanceof PType.Class clazz) {
|
} else if (type instanceof PType.Class clazz) {
|
||||||
@@ -128,35 +129,51 @@ public final class VmReference extends VmValue {
|
|||||||
} else {
|
} else {
|
||||||
var typeArgs = new ArrayList<PType>(clazz.getTypeArguments().size());
|
var typeArgs = new ArrayList<PType>(clazz.getTypeArguments().size());
|
||||||
for (var arg : clazz.getTypeArguments()) {
|
for (var arg : clazz.getTypeArguments()) {
|
||||||
typeArgs.add(normalizeTypes(arg, moduleClass));
|
typeArgs.add(normalizeTypes(arg, thisClass, moduleClass));
|
||||||
}
|
}
|
||||||
result.add(new PType.Class(clazz.getPClass(), typeArgs));
|
result.add(new PType.Class(clazz.getPClass(), typeArgs));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// normalize `T?` to `T | Null`
|
// normalize `T?` to `T | Null`
|
||||||
else if (type instanceof PType.Nullable nullable) {
|
else if (type instanceof PType.Nullable nullable) {
|
||||||
normalizeTypes(nullable.getBaseType(), moduleClass, result);
|
normalizeTypes(nullable.getBaseType(), result, thisClass, moduleClass);
|
||||||
result.add(new PType.Class(BaseModule.getNullClass().export()));
|
result.add(new PType.Class(BaseModule.getNullClass().export()));
|
||||||
// erase `T(someConstraint)` to `T`
|
// erase `T(someConstraint)` to `T`
|
||||||
} else if (type instanceof PType.Constrained constrained) {
|
} else if (type instanceof PType.Constrained constrained) {
|
||||||
normalizeTypes(constrained.getBaseType(), moduleClass, result);
|
normalizeTypes(constrained.getBaseType(), result, thisClass, moduleClass);
|
||||||
} else if (type instanceof PType.Alias alias) {
|
} else if (type instanceof PType.Alias alias) {
|
||||||
if (isPreservedTypeAlias(alias.getTypeAlias())) {
|
if (isPreservedTypeAlias(alias.getTypeAlias())) {
|
||||||
result.add(alias);
|
result.add(alias);
|
||||||
} else {
|
} else {
|
||||||
normalizeTypes(alias.getAliasedType(), alias.getTypeAlias().getModuleClass(), result);
|
normalizeTypes(alias.getAliasedType(), result, thisClass, moduleClass);
|
||||||
}
|
}
|
||||||
} else if (type instanceof PType.Union union) {
|
} else if (type instanceof PType.Union union) {
|
||||||
for (var t : union.getElementTypes()) {
|
for (var t : union.getElementTypes()) {
|
||||||
normalizeTypes(t, moduleClass, result);
|
normalizeTypes(t, result, thisClass, moduleClass);
|
||||||
}
|
}
|
||||||
|
} else if (type == PType.THIS) {
|
||||||
|
assert thisClass != null;
|
||||||
|
// there are 4 entrypoints here:
|
||||||
|
// 1. init via the Reference constructor can only normalize an unparameterized PType.Class
|
||||||
|
// 2. typecheck via ReferenceTypeNode erases self types to their actual PType.Class
|
||||||
|
// 3. subscript access can only be achieved by first performing property access, at which time
|
||||||
|
// self types are erased
|
||||||
|
// 4. property access uses the enclosing receiver's class to substitute for these self types
|
||||||
|
// only property access and typecheck can produce THIS or MODULE.
|
||||||
|
// getCandidatePropertyType and referentTypeIsSubtypeOf always pass non-null `thisClass`.
|
||||||
|
result.add(thisClass);
|
||||||
} else if (type == PType.MODULE) {
|
} else if (type == PType.MODULE) {
|
||||||
result.add(new PType.Class(moduleClass));
|
// this can be incorrect for usage of the module type in a class's property type annotation,
|
||||||
|
// which is deprecated!!
|
||||||
|
assert moduleClass != null;
|
||||||
|
// see PType.THIS case above
|
||||||
|
result.add(moduleClass);
|
||||||
} else {
|
} else {
|
||||||
// remaining types: PType.Function, PType.TypeVariable. no normalizing needed; TypeVariable
|
// remaining types: PType.Function, PType.TypeVariable. no normalizing needed; TypeVariable
|
||||||
// gets replaced upon instantiation, and Function can bubble up to users as a reference error
|
// gets replaced upon instantiation, and Function can bubble up to users as a reference error
|
||||||
// if accessed.
|
// if accessed.
|
||||||
result.add(type);
|
result.add(type);
|
||||||
|
// PType.MODULE and PType.THIS can never be encountered here; caller must deref self types
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -243,7 +260,8 @@ public final class VmReference extends VmValue {
|
|||||||
throw new VmReferenceAccessError(type, VmReferenceAccessErrorType.EXTERNAL_MEMBER);
|
throw new VmReferenceAccessError(type, VmReferenceAccessErrorType.EXTERNAL_MEMBER);
|
||||||
}
|
}
|
||||||
|
|
||||||
normalizeTypes(prop.getType(), clazz.getPClass().getModuleClass(), result);
|
normalizeTypes(
|
||||||
|
prop.getType(), result, clazz, new PType.Class(clazz.getPClass().getModuleClass()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static PClassInfo<?> getClassInfo(Object value) {
|
private static PClassInfo<?> getClassInfo(Object value) {
|
||||||
@@ -273,19 +291,19 @@ public final class VmReference extends VmValue {
|
|||||||
if (!(key instanceof Long)) {
|
if (!(key instanceof Long)) {
|
||||||
throw new VmReferenceAccessError(type, VmReferenceAccessErrorType.CANNOT_FIND_MEMBER);
|
throw new VmReferenceAccessError(type, VmReferenceAccessErrorType.CANNOT_FIND_MEMBER);
|
||||||
}
|
}
|
||||||
normalizeTypes(clazz.getTypeArguments().get(0), clazz.getPClass().getModuleClass(), result);
|
normalizeTypes(clazz.getTypeArguments().get(0), result, null, null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (clazz.getPClass().getInfo() == PClassInfo.Mapping
|
if (clazz.getPClass().getInfo() == PClassInfo.Mapping
|
||||||
|| clazz.getPClass().getInfo() == PClassInfo.Map) {
|
|| clazz.getPClass().getInfo() == PClassInfo.Map) {
|
||||||
var typeArgs = clazz.getTypeArguments();
|
var typeArgs = clazz.getTypeArguments();
|
||||||
var keyTypes = normalizeTypes(typeArgs.get(0), clazz.getPClass().getModuleClass());
|
var keyTypes = normalizeTypes(typeArgs.get(0));
|
||||||
for (var kt : iterateTypes(keyTypes)) {
|
for (var kt : iterateTypes(keyTypes)) {
|
||||||
if (kt == PType.UNKNOWN
|
if (kt == PType.UNKNOWN
|
||||||
|| (kt instanceof PType.Class klazz && klazz.getPClass().getInfo() == getClassInfo(key))
|
|| (kt instanceof PType.Class klazz && klazz.getPClass().getInfo() == getClassInfo(key))
|
||||||
|| (kt instanceof PType.StringLiteral stringLiteral
|
|| (kt instanceof PType.StringLiteral stringLiteral
|
||||||
&& stringLiteral.getLiteral().equals(key))) {
|
&& stringLiteral.getLiteral().equals(key))) {
|
||||||
normalizeTypes(typeArgs.get(1), clazz.getPClass().getModuleClass(), result);
|
normalizeTypes(typeArgs.get(1), result, null, null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -303,13 +321,14 @@ public final class VmReference extends VmValue {
|
|||||||
/**
|
/**
|
||||||
* Tells if this reference's referent type is a subtype of {@code type}. Does not check domain.
|
* Tells if this reference's referent type is a subtype of {@code type}. Does not check domain.
|
||||||
*/
|
*/
|
||||||
public boolean referentTypeIsSubtypeOf(PType type, PClass moduleClass) {
|
@TruffleBoundary
|
||||||
|
public boolean referentTypeIsSubtypeOf(PType type, PClass thisClass, PClass moduleClass) {
|
||||||
// fast path: if referent is unknown it can match any type check
|
// fast path: if referent is unknown it can match any type check
|
||||||
if (referentType == PType.UNKNOWN) {
|
if (referentType == PType.UNKNOWN) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
var checkType = normalizeTypes(type, moduleClass);
|
var checkType = normalizeTypes(type, new PType.Class(thisClass), new PType.Class(moduleClass));
|
||||||
// fast path: short circuit if any referent is accepted
|
// fast path: short circuit if any referent is accepted
|
||||||
if (checkType == PType.UNKNOWN || isClass(checkType, BaseModule.getAnyClass().export())) {
|
if (checkType == PType.UNKNOWN || isClass(checkType, BaseModule.getAnyClass().export())) {
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -137,6 +137,14 @@ public final class ReflectNodes {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public abstract static class thisType extends ExternalPropertyNode {
|
||||||
|
@Specialization
|
||||||
|
@TruffleBoundary
|
||||||
|
protected VmTyped eval(VmTyped self) {
|
||||||
|
return MirrorFactories.thisTypeFactory.create(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public abstract static class unknownType extends ExternalPropertyNode {
|
public abstract static class unknownType extends ExternalPropertyNode {
|
||||||
@Specialization
|
@Specialization
|
||||||
@TruffleBoundary
|
@TruffleBoundary
|
||||||
|
|||||||
@@ -1218,3 +1218,21 @@ Class `{0}` should either be declared `abstract`, or should implement method `{1
|
|||||||
noImplementationForAbstractMethods=\
|
noImplementationForAbstractMethods=\
|
||||||
Class `{0}` should either be declared `abstract`, or should implement the following methods:\n\
|
Class `{0}` should either be declared `abstract`, or should implement the following methods:\n\
|
||||||
{1}
|
{1}
|
||||||
|
|
||||||
|
invalidModuleTypeInProperty=\
|
||||||
|
Cannot reference `module` type from const property `{0}`.
|
||||||
|
|
||||||
|
invalidModuleTypeInMethod=\
|
||||||
|
Cannot reference `module` type from const method `{0}`.
|
||||||
|
|
||||||
|
invalidModuleTypeInClass=\
|
||||||
|
Cannot reference `module` type within a class body.
|
||||||
|
|
||||||
|
invalidModuleTypeInAnnotation=\
|
||||||
|
Cannot reference `module` type within an annotation body.
|
||||||
|
|
||||||
|
invalidModuleTypeInTypeAlias=\
|
||||||
|
Cannot reference `module` type within a type alias body.
|
||||||
|
|
||||||
|
invalidThisTypeInTypeAlias=\
|
||||||
|
Cannot reference `this` type within a type alias body.
|
||||||
|
|||||||
+2
@@ -48,6 +48,8 @@ nullable: Person?
|
|||||||
stringLiteral: "yes"
|
stringLiteral: "yes"
|
||||||
constrained: String(length.isBetween(3, 10))
|
constrained: String(length.isBetween(3, 10))
|
||||||
aliased: MyMap<Person>
|
aliased: MyMap<Person>
|
||||||
|
mod: module
|
||||||
|
self: this
|
||||||
|
|
||||||
hidden hiddenProp: String
|
hidden hiddenProp: String
|
||||||
const constProp: String = "the const prop"
|
const constProp: String = "the const prop"
|
||||||
|
|||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
typealias MyList<T> = List<T>
|
||||||
+6
@@ -0,0 +1,6 @@
|
|||||||
|
open module moduleTypeProperty
|
||||||
|
|
||||||
|
x = 1
|
||||||
|
y = mod.x
|
||||||
|
modName = module.getClass().toString()
|
||||||
|
hidden mod: module
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
import "pkl:math"
|
import "pkl:math"
|
||||||
import "pkl:ref"
|
import "pkl:ref"
|
||||||
|
import "pkl:test"
|
||||||
|
|
||||||
class D extends ref.Domain {
|
class D extends ref.Domain {
|
||||||
function renderReference(reference: ref.Reference<D, Any>): String =
|
function renderReference(reference: ref.Reference<this, Any>): String =
|
||||||
let (data = reference.getData())
|
let (data = reference.getData())
|
||||||
let (root = if (data is Resource) data.name else data.toString())
|
let (root = if (data is Resource) data.name else data.toString())
|
||||||
let (
|
let (
|
||||||
@@ -19,13 +20,12 @@ typealias Ref<T> = ref.Reference<D, T>
|
|||||||
|
|
||||||
abstract class Resource {
|
abstract class Resource {
|
||||||
name: String
|
name: String
|
||||||
hidden fixed $: Ref<Resource>
|
hidden fixed $: Ref<this> = ref.Reference(d, getClass(), this)
|
||||||
}
|
}
|
||||||
|
|
||||||
class A extends Resource {
|
class A extends Resource {
|
||||||
id: String
|
id: String
|
||||||
hidden outputs: AProperties
|
hidden outputs: AProperties
|
||||||
hidden fixed $: Ref<A> = ref.Reference(d, A, this)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Test doc comment
|
/// Test doc comment
|
||||||
@@ -42,7 +42,6 @@ class AProperties {
|
|||||||
class B extends Resource {
|
class B extends Resource {
|
||||||
id: String
|
id: String
|
||||||
hidden outputs: BProperties
|
hidden outputs: BProperties
|
||||||
hidden fixed $: Ref<B> = ref.Reference(d, B, this)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class BProperties {
|
class BProperties {
|
||||||
@@ -128,6 +127,13 @@ class TypeHolder {
|
|||||||
prop: Listing<String | Boolean | Number>
|
prop: Listing<String | Boolean | Number>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class BadResource extends Resource {
|
||||||
|
// return a reference with referent that isn't `this`
|
||||||
|
fixed $ = ref.Reference(d, A, this)
|
||||||
|
}
|
||||||
|
|
||||||
|
badThisRef = test.catch(() -> new BadResource { name = "bad" }.$.toString())
|
||||||
|
|
||||||
output {
|
output {
|
||||||
renderer {
|
renderer {
|
||||||
converters {
|
converters {
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ facts {
|
|||||||
modClassProps["aliased"].type ==
|
modClassProps["aliased"].type ==
|
||||||
reflect.DeclaredType(reflect.TypeAlias(BaseModule.MyMap))
|
reflect.DeclaredType(reflect.TypeAlias(BaseModule.MyMap))
|
||||||
.withTypeArgument(reflect.DeclaredType(reflect.Class(BaseModule.Person)))
|
.withTypeArgument(reflect.DeclaredType(reflect.Class(BaseModule.Person)))
|
||||||
|
modClassProps["mod"].type == reflect.moduleType
|
||||||
|
modClassProps["self"].type == reflect.thisType
|
||||||
}
|
}
|
||||||
|
|
||||||
["Reflecting a class"] {
|
["Reflecting a class"] {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ amends "../snippetTest.pkl"
|
|||||||
import "pkl:ref"
|
import "pkl:ref"
|
||||||
|
|
||||||
local class D extends ref.Domain {
|
local class D extends ref.Domain {
|
||||||
function renderReference(reference: ref.Reference<D, Any>): String = reference.getData().toString()
|
function renderReference(reference: ref.Reference<this, Any>): String = reference.getData().toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
local const d: D = new {}
|
local const d: D = new {}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import "pkl:ref"
|
import "pkl:ref"
|
||||||
|
|
||||||
class D extends ref.Domain {
|
class D extends ref.Domain {
|
||||||
function renderReference(reference: ref.Reference<D, Any>): String = throw("not supported")
|
function renderReference(reference: ref.Reference<this, Any>): String = throw("not supported")
|
||||||
}
|
}
|
||||||
local d: D = new {}
|
local d: D = new {}
|
||||||
typealias Ref<T> = ref.Reference<D, T>
|
typealias Ref<T> = ref.Reference<D, T>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import "pkl:ref"
|
import "pkl:ref"
|
||||||
|
|
||||||
class D extends ref.Domain {
|
class D extends ref.Domain {
|
||||||
function renderReference(reference: ref.Reference<D, Any>): String = throw("not supported")
|
function renderReference(reference: ref.Reference<this, Any>): String = throw("not supported")
|
||||||
}
|
}
|
||||||
typealias Ref<T> = ref.Reference<D, T>
|
typealias Ref<T> = ref.Reference<D, T>
|
||||||
local d: D = new {}
|
local d: D = new {}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import "pkl:ref"
|
import "pkl:ref"
|
||||||
|
|
||||||
class D extends ref.Domain {
|
class D extends ref.Domain {
|
||||||
function renderReference(reference: ref.Reference<D, Any>): String = throw("not supported")
|
function renderReference(reference: ref.Reference<this, Any>): String = throw("not supported")
|
||||||
}
|
}
|
||||||
typealias Ref<T> = ref.Reference<D, T>
|
typealias Ref<T> = ref.Reference<D, T>
|
||||||
local d: D = new {}
|
local d: D = new {}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import "pkl:ref"
|
import "pkl:ref"
|
||||||
|
|
||||||
class D extends ref.Domain {
|
class D extends ref.Domain {
|
||||||
function renderReference(reference: ref.Reference<D, Any>): String = throw("not supported")
|
function renderReference(reference: ref.Reference<this, Any>): String = throw("not supported")
|
||||||
}
|
}
|
||||||
typealias RefAlias1 = ref.Reference<D, Alias1?>
|
typealias RefAlias1 = ref.Reference<D, Alias1?>
|
||||||
local d: D = new {}
|
local d: D = new {}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import "pkl:ref"
|
import "pkl:ref"
|
||||||
|
|
||||||
class D extends ref.Domain {
|
class D extends ref.Domain {
|
||||||
function renderReference(reference: ref.Reference<D, Any>): String = throw("not supported")
|
function renderReference(reference: ref.Reference<this, Any>): String = throw("not supported")
|
||||||
}
|
}
|
||||||
local d: D = new {}
|
local d: D = new {}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import "pkl:ref"
|
import "pkl:ref"
|
||||||
|
|
||||||
class D extends ref.Domain {
|
class D extends ref.Domain {
|
||||||
function renderReference(reference: ref.Reference<D, Any>): String = throw("not supported")
|
function renderReference(reference: ref.Reference<this, Any>): String = throw("not supported")
|
||||||
}
|
}
|
||||||
local d: D = new {}
|
local d: D = new {}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import "pkl:ref"
|
import "pkl:ref"
|
||||||
|
|
||||||
class D extends ref.Domain {
|
class D extends ref.Domain {
|
||||||
function renderReference(reference: ref.Reference<D, Any>): String = throw("not supported")
|
function renderReference(reference: ref.Reference<this, Any>): String = throw("not supported")
|
||||||
}
|
}
|
||||||
local d: D = new {}
|
local d: D = new {}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import "pkl:ref"
|
|||||||
import ".../input-helper/errors/ReferencedModule.pkl"
|
import ".../input-helper/errors/ReferencedModule.pkl"
|
||||||
|
|
||||||
class D extends ref.Domain {
|
class D extends ref.Domain {
|
||||||
function renderReference(reference: ref.Reference<D, Any>): String = throw("not supported")
|
function renderReference(reference: ref.Reference<this, Any>): String = throw("not supported")
|
||||||
}
|
}
|
||||||
local d: D = new {}
|
local d: D = new {}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import "pkl:ref"
|
|||||||
import ".../input-helper/errors/ReferencedModuleWithOutputOverride.pkl"
|
import ".../input-helper/errors/ReferencedModuleWithOutputOverride.pkl"
|
||||||
|
|
||||||
class D extends ref.Domain {
|
class D extends ref.Domain {
|
||||||
function renderReference(reference: ref.Reference<D, Any>): String = throw("not supported")
|
function renderReference(reference: ref.Reference<this, Any>): String = throw("not supported")
|
||||||
}
|
}
|
||||||
local d: D = new {}
|
local d: D = new {}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import ".../input-helper/errors/ReferencedModuleWithOutputOverride.pkl"
|
|||||||
class ModuleSubclass extends ReferencedModuleWithOutputOverride
|
class ModuleSubclass extends ReferencedModuleWithOutputOverride
|
||||||
|
|
||||||
class D extends ref.Domain {
|
class D extends ref.Domain {
|
||||||
function renderReference(reference: ref.Reference<D, Any>): String = throw("not supported")
|
function renderReference(reference: ref.Reference<this, Any>): String = throw("not supported")
|
||||||
}
|
}
|
||||||
local d: D = new {}
|
local d: D = new {}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ class A {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class D extends ref.Domain {
|
class D extends ref.Domain {
|
||||||
function renderReference(reference: ref.Reference<D, Any>): String = throw("not supported")
|
function renderReference(reference: ref.Reference<this, Any>): String = throw("not supported")
|
||||||
}
|
}
|
||||||
local d: D = new {}
|
local d: D = new {}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import "pkl:ref"
|
import "pkl:ref"
|
||||||
|
|
||||||
class D extends ref.Domain {
|
class D extends ref.Domain {
|
||||||
function renderReference(reference: ref.Reference<D, Any>): String = throw("not supported")
|
function renderReference(reference: ref.Reference<this, Any>): String = throw("not supported")
|
||||||
}
|
}
|
||||||
local d: D = new {}
|
local d: D = new {}
|
||||||
typealias Ref<T> = ref.Reference<D, T>
|
typealias Ref<T> = ref.Reference<D, T>
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ class A {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class D extends ref.Domain {
|
class D extends ref.Domain {
|
||||||
function renderReference(reference: ref.Reference<D, Any>): String = throw("not supported")
|
function renderReference(reference: ref.Reference<this, Any>): String = throw("not supported")
|
||||||
}
|
}
|
||||||
local d: D = new {}
|
local d: D = new {}
|
||||||
|
|
||||||
local test = ref.Reference(d, A, "").foo
|
local test = ref.Reference(d, A, "").foo
|
||||||
testInterpolation = "test:\(test)"
|
testInterpolation = "test:\(test)"
|
||||||
|
|
||||||
// this tests that the interpolation appears in the output when referenceToString throws
|
// this tests that the interpolation appears in the output when renderReference throws
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
// interactions between references and self types
|
||||||
|
|
||||||
|
import "pkl:ref"
|
||||||
|
|
||||||
|
class D extends ref.Domain {
|
||||||
|
function renderReference(r: ref.Reference<this, Any>): String =
|
||||||
|
r.getPath().map((it) -> it.property ?? it.key.toString()).join(".")
|
||||||
|
}
|
||||||
|
|
||||||
|
// this type in a final class
|
||||||
|
class Node {
|
||||||
|
parent: this?
|
||||||
|
children: List<this>
|
||||||
|
}
|
||||||
|
|
||||||
|
// this type in an open class
|
||||||
|
open class Node2 {
|
||||||
|
parent: this?
|
||||||
|
children: List<this>
|
||||||
|
}
|
||||||
|
|
||||||
|
typealias R = ref.Reference<D, Node?>
|
||||||
|
typealias R2 = ref.Reference<D, Node2?>
|
||||||
|
|
||||||
|
res0: R = ref.Reference(new D {}, Node, null)
|
||||||
|
res1: R = res0.parent
|
||||||
|
res2: R = res0.parent.parent
|
||||||
|
res3: R = res0.children[0]
|
||||||
|
res4: R = res0.children[0].parent
|
||||||
|
res5: R = res0.children[0].children[0]
|
||||||
|
|
||||||
|
res0a: R2 = ref.Reference(new D {}, Node2, null)
|
||||||
|
res1a: R2 = res0a.parent
|
||||||
|
res2a: R2 = res0a.parent.parent
|
||||||
|
res3a: R2 = res0a.children[0]
|
||||||
|
res4a: R2 = res0a.children[0].parent
|
||||||
|
res5a: R2 = res0a.children[0].children[0]
|
||||||
|
|
||||||
|
output {
|
||||||
|
renderer {
|
||||||
|
converters {
|
||||||
|
[ref.Reference] = (it) -> it.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
open module reference29
|
||||||
|
|
||||||
|
// interactions between references and self types
|
||||||
|
// module type in an open module
|
||||||
|
|
||||||
|
import "pkl:ref"
|
||||||
|
import "reference29.pkl"
|
||||||
|
|
||||||
|
class D extends ref.Domain {
|
||||||
|
function renderReference(r: ref.Reference<this, Any>): String =
|
||||||
|
r.getPath().map((it) -> it.property ?? it.key.toString()).join(".")
|
||||||
|
}
|
||||||
|
|
||||||
|
hidden parent: module?
|
||||||
|
hidden children: List<module>
|
||||||
|
|
||||||
|
typealias R = ref.Reference<D, reference29?>
|
||||||
|
|
||||||
|
res0 = ref.Reference(new D {}, getClass(), null)
|
||||||
|
res1: R = res0.parent
|
||||||
|
res2: R = res0.parent.parent
|
||||||
|
res3: R = res0.children[0]
|
||||||
|
res4: R = res0.children[0].parent
|
||||||
|
res5: R = res0.children[0].children[0]
|
||||||
|
|
||||||
|
output {
|
||||||
|
renderer {
|
||||||
|
converters {
|
||||||
|
[ref.Reference] = (it) -> it.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import "pkl:ref"
|
import "pkl:ref"
|
||||||
|
|
||||||
class D extends ref.Domain {
|
class D extends ref.Domain {
|
||||||
function renderReference(reference: ref.Reference<D, Any>): String = throw("not supported")
|
function renderReference(reference: ref.Reference<this, Any>): String = throw("not supported")
|
||||||
}
|
}
|
||||||
local d: D = new {}
|
local d: D = new {}
|
||||||
typealias Ref<T> = ref.Reference<D, T>
|
typealias Ref<T> = ref.Reference<D, T>
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
// interactions between references and self types
|
||||||
|
// module type in a final module
|
||||||
|
|
||||||
|
import "pkl:ref"
|
||||||
|
import "reference30.pkl"
|
||||||
|
|
||||||
|
class D extends ref.Domain {
|
||||||
|
function renderReference(r: ref.Reference<this, Any>): String =
|
||||||
|
r.getPath().map((it) -> it.property ?? it.key.toString()).join(".")
|
||||||
|
}
|
||||||
|
|
||||||
|
hidden parent: module?
|
||||||
|
hidden children: List<module>
|
||||||
|
|
||||||
|
typealias R = ref.Reference<D, reference30?>
|
||||||
|
|
||||||
|
res0 = ref.Reference(new D {}, getClass(), null)
|
||||||
|
res1: R = res0.parent
|
||||||
|
res2: R = res0.parent.parent
|
||||||
|
res3: R = res0.children[0]
|
||||||
|
res4: R = res0.children[0].parent
|
||||||
|
res5: R = res0.children[0].children[0]
|
||||||
|
|
||||||
|
output {
|
||||||
|
renderer {
|
||||||
|
converters {
|
||||||
|
[ref.Reference] = (it) -> it.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import "pkl:ref"
|
import "pkl:ref"
|
||||||
|
|
||||||
class D extends ref.Domain {
|
class D extends ref.Domain {
|
||||||
function renderReference(reference: ref.Reference<D, Any>): String = throw("not supported")
|
function renderReference(reference: ref.Reference<this, Any>): String = throw("not supported")
|
||||||
}
|
}
|
||||||
local d: D = new {}
|
local d: D = new {}
|
||||||
typealias Ref<T> = ref.Reference<D, T>
|
typealias Ref<T> = ref.Reference<D, T>
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import "pkl:ref"
|
import "pkl:ref"
|
||||||
|
|
||||||
class D extends ref.Domain {
|
class D extends ref.Domain {
|
||||||
function renderReference(reference: ref.Reference<D, Any>): String = throw("not supported")
|
function renderReference(reference: ref.Reference<this, Any>): String = throw("not supported")
|
||||||
}
|
}
|
||||||
local d: D = new {}
|
local d: D = new {}
|
||||||
typealias Ref<T> = ref.Reference<D, T>
|
typealias Ref<T> = ref.Reference<D, T>
|
||||||
|
|
||||||
class D2 extends ref.Domain {
|
class D2 extends ref.Domain {
|
||||||
function renderReference(reference: ref.Reference<D, Any>): String = throw("not supported")
|
function renderReference(reference: ref.Reference<this, Any>): String = throw("not supported")
|
||||||
}
|
}
|
||||||
local d2: D2 = new {}
|
local d2: D2 = new {}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import "pkl:ref"
|
import "pkl:ref"
|
||||||
|
|
||||||
class D extends ref.Domain {
|
class D extends ref.Domain {
|
||||||
function renderReference(reference: ref.Reference<D, Any>): String = throw("not supported")
|
function renderReference(reference: ref.Reference<this, Any>): String = throw("not supported")
|
||||||
}
|
}
|
||||||
local d: D = new {}
|
local d: D = new {}
|
||||||
typealias Ref<T> = ref.Reference<D, T>
|
typealias Ref<T> = ref.Reference<D, T>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import "pkl:ref"
|
import "pkl:ref"
|
||||||
|
|
||||||
class D extends ref.Domain {
|
class D extends ref.Domain {
|
||||||
function renderReference(reference: ref.Reference<D, Any>): String = throw("not supported")
|
function renderReference(reference: ref.Reference<this, Any>): String = throw("not supported")
|
||||||
}
|
}
|
||||||
local d: D = new {}
|
local d: D = new {}
|
||||||
typealias Ref<T> = ref.Reference<D, T>
|
typealias Ref<T> = ref.Reference<D, T>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import "pkl:ref"
|
import "pkl:ref"
|
||||||
|
|
||||||
class D extends ref.Domain {
|
class D extends ref.Domain {
|
||||||
function renderReference(reference: ref.Reference<D, Any>): String = throw("not supported")
|
function renderReference(reference: ref.Reference<this, Any>): String = throw("not supported")
|
||||||
}
|
}
|
||||||
typealias Ref<T> = ref.Reference<D, T>
|
typealias Ref<T> = ref.Reference<D, T>
|
||||||
local d: D = new {}
|
local d: D = new {}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import "pkl:ref"
|
import "pkl:ref"
|
||||||
|
|
||||||
class D extends ref.Domain {
|
class D extends ref.Domain {
|
||||||
function renderReference(reference: ref.Reference<D, Any>): String = throw("not supported")
|
function renderReference(reference: ref.Reference<this, Any>): String = throw("not supported")
|
||||||
}
|
}
|
||||||
typealias Ref<T> = ref.Reference<D, T>
|
typealias Ref<T> = ref.Reference<D, T>
|
||||||
local d: D = new {}
|
local d: D = new {}
|
||||||
|
|||||||
+11
-11
@@ -42,15 +42,15 @@ output {
|
|||||||
// force eval but don't render to prevent recursion
|
// force eval but don't render to prevent recursion
|
||||||
value =
|
value =
|
||||||
let (r1 = res1)
|
let (r1 = res1)
|
||||||
let (r2 = res2)
|
let (r2 = res2)
|
||||||
let (r3 = res3)
|
let (r3 = res3)
|
||||||
let (r4 = res4)
|
let (r4 = res4)
|
||||||
let (r5 = res5)
|
let (r5 = res5)
|
||||||
let (r6 = res6)
|
let (r6 = res6)
|
||||||
let (r6a = res6a)
|
let (r6a = res6a)
|
||||||
let (r7 = res7)
|
let (r7 = res7)
|
||||||
let (r8 = res8)
|
let (r8 = res8)
|
||||||
let (r9 = res9)
|
let (r9 = res9)
|
||||||
let (r10 = res10)
|
let (r10 = res10)
|
||||||
new Dynamic { result = "ok" }
|
new Dynamic { result = "ok" }
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-11
@@ -44,15 +44,15 @@ output {
|
|||||||
// force eval but don't render to prevent recursion
|
// force eval but don't render to prevent recursion
|
||||||
value =
|
value =
|
||||||
let (r1 = res1)
|
let (r1 = res1)
|
||||||
let (r2 = res2)
|
let (r2 = res2)
|
||||||
let (r3 = res3)
|
let (r3 = res3)
|
||||||
let (r4 = res4)
|
let (r4 = res4)
|
||||||
let (r5 = res5)
|
let (r5 = res5)
|
||||||
let (r6 = res6)
|
let (r6 = res6)
|
||||||
let (r6a = res6a)
|
let (r6a = res6a)
|
||||||
let (r7 = res7)
|
let (r7 = res7)
|
||||||
let (r8 = res8)
|
let (r8 = res8)
|
||||||
let (r9 = res9)
|
let (r9 = res9)
|
||||||
let (r10 = res10)
|
let (r10 = res10)
|
||||||
new Dynamic { result = "ok" }
|
new Dynamic { result = "ok" }
|
||||||
}
|
}
|
||||||
|
|||||||
+21
@@ -0,0 +1,21 @@
|
|||||||
|
typealias Foo = module
|
||||||
|
|
||||||
|
@Baz { valid = true is module }
|
||||||
|
class Bar {
|
||||||
|
baz: module
|
||||||
|
}
|
||||||
|
|
||||||
|
class Baz extends Annotation {
|
||||||
|
valid: Boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
const qux = true is module
|
||||||
|
const function quux() = true is module
|
||||||
|
|
||||||
|
const corge = new {
|
||||||
|
grault {
|
||||||
|
garply = true is module
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
hidden const waldo = (x: module) -> true
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
open module currentModuleType5
|
||||||
|
|
||||||
|
import ".../input-helper/types/aliasHolder.pkl"
|
||||||
|
|
||||||
|
local foo: aliasHolder.MyList<module> = List(this)
|
||||||
|
x = 1
|
||||||
|
y = foo.first.x
|
||||||
+21
@@ -0,0 +1,21 @@
|
|||||||
|
import "pkl:test"
|
||||||
|
|
||||||
|
import ".../input-helper/types/moduleTypeProperty.pkl"
|
||||||
|
|
||||||
|
class ModuleSubclass extends moduleTypeProperty {
|
||||||
|
x = 2
|
||||||
|
hidden mod2: module
|
||||||
|
mod2x = mod2.x
|
||||||
|
}
|
||||||
|
|
||||||
|
x = -1
|
||||||
|
|
||||||
|
res1 = new moduleTypeProperty {}
|
||||||
|
res2 = new moduleTypeProperty {
|
||||||
|
mod = new ModuleSubclass {}
|
||||||
|
}
|
||||||
|
res3 = new ModuleSubclass {}
|
||||||
|
res4 =
|
||||||
|
test.catch(() -> new ModuleSubclass {
|
||||||
|
mod = new moduleTypeProperty {}
|
||||||
|
}.output.text)
|
||||||
@@ -0,0 +1,150 @@
|
|||||||
|
open module thisType1
|
||||||
|
|
||||||
|
import "pkl:test"
|
||||||
|
import "pkl:reflect"
|
||||||
|
|
||||||
|
hidden x: Int = 1
|
||||||
|
|
||||||
|
hidden res1: this = module
|
||||||
|
|
||||||
|
res1a = res1.res2.x
|
||||||
|
res1b = res1.res3.x
|
||||||
|
res1c = res1.res5[1].x
|
||||||
|
res1d = res1.res6a.x
|
||||||
|
res1e = res1.res6b.x
|
||||||
|
|
||||||
|
hidden res2: this = this
|
||||||
|
hidden res3: this = (this) { x = super.x + 1 }
|
||||||
|
res4: this? = null
|
||||||
|
hidden res5: List<this> = List(this, (this) { x = super.x + 2 })
|
||||||
|
hidden res6: List<this> = fun(this)
|
||||||
|
hidden res6a: this = res6[0]
|
||||||
|
hidden res6b: this = fun(new Good { x = 3 })[0]
|
||||||
|
|
||||||
|
function fun(m: this): List<this> =
|
||||||
|
let (_x = x)
|
||||||
|
List((m) { x = super.x + _x })
|
||||||
|
|
||||||
|
typealias Foo<T> = T
|
||||||
|
|
||||||
|
function fun2(m: Foo<this>): List<this> =
|
||||||
|
let (_x = x)
|
||||||
|
List((m) { x = super.x + _x + 1 })
|
||||||
|
|
||||||
|
class Bad {
|
||||||
|
res7: this = "abc"
|
||||||
|
res8: this = new Person {}
|
||||||
|
res9: this? = new Person {}
|
||||||
|
res10: List<this> = List(new Person {})
|
||||||
|
}
|
||||||
|
|
||||||
|
class Person
|
||||||
|
|
||||||
|
res7 = test.catch(() -> new Bad {}.res7)
|
||||||
|
res8 = test.catch(() -> new Bad {}.res8)
|
||||||
|
res9 = test.catch(() -> new Bad {}.res9)
|
||||||
|
res10 = test.catch(() -> new Bad {}.res10)
|
||||||
|
|
||||||
|
class Good extends module {
|
||||||
|
x = 2
|
||||||
|
}
|
||||||
|
|
||||||
|
local res11 = new Good {}
|
||||||
|
|
||||||
|
res11a = res11.res2.x
|
||||||
|
res11b = res11.res3.x
|
||||||
|
res11c = res11.res5[1].x
|
||||||
|
res11d = res11.res6a.x
|
||||||
|
|
||||||
|
res12 = test.catch(() -> res11.fun(module)[0].x)
|
||||||
|
|
||||||
|
// this type not affected by custom this scope:
|
||||||
|
hidden res13: List(this is List<this>) = List(module)
|
||||||
|
res13a = res13[0].x
|
||||||
|
|
||||||
|
// test generic typealias through inheritance from module
|
||||||
|
res14 = fun2(this).map((it) -> it.x)
|
||||||
|
res14a = test.catch(() -> res11.fun2(this))
|
||||||
|
res14b = res11.fun2(res11)[0].x
|
||||||
|
|
||||||
|
// test generic typealias without inheritance from module
|
||||||
|
open class A {
|
||||||
|
x: Int = 1
|
||||||
|
function fun2(m: Foo<this>): List<this> =
|
||||||
|
let (_x = x)
|
||||||
|
List((m) { x = super.x + _x + 1 })
|
||||||
|
}
|
||||||
|
class B extends A
|
||||||
|
|
||||||
|
local a = new A {}
|
||||||
|
local b = new B {}
|
||||||
|
res15 = a.fun2(a)
|
||||||
|
res15a = test.catch(() -> b.fun2(a))
|
||||||
|
res15b = b.fun2(b)
|
||||||
|
|
||||||
|
// test function type, function literal param, object body param
|
||||||
|
local c: (this) -> Dynamic = (xx: this) -> new Dynamic { x = xx.x * 2 }
|
||||||
|
local d = (c) { xx: this ->
|
||||||
|
x = super.x + xx.x * 3
|
||||||
|
}
|
||||||
|
res16 = d.apply(this).x
|
||||||
|
res16a = test.catch(() -> d.apply(new Dynamic { x = 1 }).x)
|
||||||
|
|
||||||
|
// let expr binding type
|
||||||
|
res17 =
|
||||||
|
let (xx: this = new module { x = 3 })
|
||||||
|
xx.x
|
||||||
|
|
||||||
|
// for/when generator vars skip a level
|
||||||
|
res18: Listing<Int> = new {
|
||||||
|
for (xx: this in List(module)) {
|
||||||
|
xx.x
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// object property/method param/method return
|
||||||
|
res19 = new Dynamic {
|
||||||
|
local foo: this = new Dynamic { x = 1 }
|
||||||
|
local function bar(a: this): this = new { x = foo.x + a.x }
|
||||||
|
baz = bar(new Dynamic { x = 2 })
|
||||||
|
}
|
||||||
|
|
||||||
|
// type cast, explicit new expr
|
||||||
|
hidden res20 = new this { x = 6 } as this
|
||||||
|
res20a = res20.x
|
||||||
|
|
||||||
|
// constrained
|
||||||
|
hidden res21: this(this.x > 5) = res20
|
||||||
|
res21a = res21.x
|
||||||
|
|
||||||
|
// lazy type check and default value
|
||||||
|
hidden res22: Listing<this> = new {
|
||||||
|
new { x = 1 }
|
||||||
|
new Good {}
|
||||||
|
new { x = 3 }
|
||||||
|
new Good { x = 4 }
|
||||||
|
}
|
||||||
|
|
||||||
|
res22a = module.res22.toList().map((it) -> "\(it.getClass()): \(it.x)").toListing()
|
||||||
|
res22b = new Good {}.res22.toList().map((it) -> "\(it.getClass()): \(it.x)").toListing()
|
||||||
|
|
||||||
|
// annotation type
|
||||||
|
|
||||||
|
open class ThisAnnotation extends Annotation {
|
||||||
|
@this { y = 1 }
|
||||||
|
y: Int
|
||||||
|
}
|
||||||
|
|
||||||
|
open class ThatAnnotation extends ThisAnnotation
|
||||||
|
|
||||||
|
@ThisAnnotation { y = 2 }
|
||||||
|
hidden annThis: Int = 1
|
||||||
|
res23 = reflect.Class(getClass()).properties["annThis"].annotations.single
|
||||||
|
res23a = res23.getClass().toString()
|
||||||
|
res23b = reflect.Class(res23.getClass()).allProperties["y"].annotations.single.getClass().toString()
|
||||||
|
|
||||||
|
@ThatAnnotation { y = 2 }
|
||||||
|
hidden annThat: Int = 1
|
||||||
|
res24 = reflect.Class(getClass()).properties["annThat"].annotations.single
|
||||||
|
res24a = res24.getClass().toString()
|
||||||
|
res24b = reflect.Class(res24.getClass()).allProperties["y"].annotations.single.getClass().toString()
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
typealias Foo = this
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
// cover custom this contexts in a final module
|
||||||
|
|
||||||
|
local foo: Listing(any((it) -> it is this)) = new { bar }
|
||||||
|
local bar: Listing = new { foo }
|
||||||
|
res1 = foo.length
|
||||||
|
|
||||||
|
local baz: Listing = new {
|
||||||
|
new Listing { "hello" }
|
||||||
|
new Mapping { ["hello"] = "world" }
|
||||||
|
module
|
||||||
|
}
|
||||||
|
|
||||||
|
res2 = (baz) {
|
||||||
|
[[this is this]] {
|
||||||
|
res2 = "blah"
|
||||||
|
}
|
||||||
|
when (module is this) {
|
||||||
|
123
|
||||||
|
}
|
||||||
|
module is this
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
open module thisType4
|
||||||
|
// cover custom this contexts in an open module
|
||||||
|
|
||||||
|
local foo: Listing(any((it) -> it is this)) = new { bar }
|
||||||
|
local bar: Listing = new { foo }
|
||||||
|
res1 = foo.length
|
||||||
|
|
||||||
|
local baz: Listing = new {
|
||||||
|
new Listing { "hello" }
|
||||||
|
new Mapping { ["hello"] = "world" }
|
||||||
|
module
|
||||||
|
}
|
||||||
|
|
||||||
|
res2 = (baz) {
|
||||||
|
[[this is this]] {
|
||||||
|
res2 = "blah"
|
||||||
|
}
|
||||||
|
when (module is this) {
|
||||||
|
123
|
||||||
|
}
|
||||||
|
module is this
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
// test this type interacting with local class
|
||||||
|
|
||||||
|
local class Foo {
|
||||||
|
bar: this? = new { bar = null }
|
||||||
|
baz = new Foo {} is this
|
||||||
|
|
||||||
|
function qux(a: this): this = this
|
||||||
|
function quux(a: Any): Boolean = a is this
|
||||||
|
}
|
||||||
|
|
||||||
|
local foo = new Foo {}
|
||||||
|
|
||||||
|
res1 = foo.bar
|
||||||
|
res2 = foo.baz
|
||||||
|
res3 = foo.qux(new Foo {})
|
||||||
|
res4 = foo.quux(new Foo {})
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
open module thisType6
|
||||||
|
|
||||||
|
class Foo extends this
|
||||||
@@ -60,3 +60,4 @@ aValuesJoined = """
|
|||||||
${b.outputs.nonString}
|
${b.outputs.nonString}
|
||||||
"""
|
"""
|
||||||
typeArgs = "${null.prop}"
|
typeArgs = "${null.prop}"
|
||||||
|
badThisRef = "Expected value of type `pkl.ref#Reference<reference#D, this>`, but got type `pkl.ref#Reference<reference#D, reference#A>`. Value: Reference(new D {}, reference#A, new BadResource { name = ? })"
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ facts {
|
|||||||
true
|
true
|
||||||
true
|
true
|
||||||
true
|
true
|
||||||
|
true
|
||||||
|
true
|
||||||
}
|
}
|
||||||
["Reflecting a class"] {
|
["Reflecting a class"] {
|
||||||
true
|
true
|
||||||
@@ -67,7 +69,7 @@ facts {
|
|||||||
}
|
}
|
||||||
examples {
|
examples {
|
||||||
["Reflected module properties of unknown type metadata"] {
|
["Reflected module properties of unknown type metadata"] {
|
||||||
Set("int", "float", "string", "boolean", "duration", "dataSize", "pair", "list", "set", "map", "listing", "mapping", "dynamic", "typed", "int2", "float2", "string2", "boolean2", "duration2", "dataSize2", "pair2", "list2", "set2", "map2", "listing2", "mapping2", "dynamic2", "typed2", "any", "noth", "unkn", "union", "nullable", "stringLiteral", "constrained", "aliased", "hiddenProp", "constProp", "fixedProp")
|
Set("int", "float", "string", "boolean", "duration", "dataSize", "pair", "list", "set", "map", "listing", "mapping", "dynamic", "typed", "int2", "float2", "string2", "boolean2", "duration2", "dataSize2", "pair2", "list2", "set2", "map2", "listing2", "mapping2", "dynamic2", "typed2", "any", "noth", "unkn", "union", "nullable", "stringLiteral", "constrained", "aliased", "mod", "self", "hiddenProp", "constProp", "fixedProp")
|
||||||
new {
|
new {
|
||||||
hasExpectedLocation = true
|
hasExpectedLocation = true
|
||||||
docComment = "module property doc comment"
|
docComment = "module property doc comment"
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
–– Pkl Error ––
|
–– Pkl Error ––
|
||||||
not supported
|
not supported
|
||||||
|
|
||||||
x | function renderReference(reference: ref.Reference<D, Any>): String = throw("not supported")
|
x | function renderReference(reference: ref.Reference<this, Any>): String = throw("not supported")
|
||||||
^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^
|
||||||
at reference20#D.renderReference (file:///$snippetsDir/input/errors/reference20.pkl)
|
at reference20#D.renderReference (file:///$snippetsDir/input/errors/reference20.pkl)
|
||||||
|
|
||||||
xxx | function toString(): String = getDomain().renderReference(this)
|
xxx | function toString(): String = getDomain().renderReference(this)
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
res0 = ""
|
||||||
|
res1 = "parent"
|
||||||
|
res2 = "parent.parent"
|
||||||
|
res3 = "children.0"
|
||||||
|
res4 = "children.0.parent"
|
||||||
|
res5 = "children.0.children.0"
|
||||||
|
res0a = ""
|
||||||
|
res1a = "parent"
|
||||||
|
res2a = "parent.parent"
|
||||||
|
res3a = "children.0"
|
||||||
|
res4a = "children.0.parent"
|
||||||
|
res5a = "children.0.children.0"
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
res0 = ""
|
||||||
|
res1 = "parent"
|
||||||
|
res2 = "parent.parent"
|
||||||
|
res3 = "children.0"
|
||||||
|
res4 = "children.0.parent"
|
||||||
|
res5 = "children.0.children.0"
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
res0 = ""
|
||||||
|
res1 = "parent"
|
||||||
|
res2 = "parent.parent"
|
||||||
|
res3 = "children.0"
|
||||||
|
res4 = "children.0.parent"
|
||||||
|
res5 = "children.0.children.0"
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
result = "ok"
|
||||||
|
pkl: WARN: Cannot reference `module` type within a class body. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType1.pkl)
|
||||||
|
pkl: WARN: Cannot reference `module` type within a class body. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType1.pkl)
|
||||||
|
pkl: WARN: Cannot reference `module` type within a class body. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType1.pkl)
|
||||||
|
pkl: WARN: Cannot reference `module` type within a class body. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType1.pkl)
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
result = "ok"
|
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
result = "ok"
|
||||||
|
pkl: WARN: Cannot reference `module` type within a class body. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType2.pkl)
|
||||||
|
pkl: WARN: Cannot reference `module` type within a class body. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType2.pkl)
|
||||||
|
pkl: WARN: Cannot reference `module` type within a class body. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType2.pkl)
|
||||||
|
pkl: WARN: Cannot reference `module` type within a class body. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType2.pkl)
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
result = "ok"
|
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
result = "ok"
|
||||||
|
pkl: WARN: Cannot reference `module` type within a class body. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType2.pkl)
|
||||||
|
pkl: WARN: Cannot reference `module` type within a class body. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType2.pkl)
|
||||||
|
pkl: WARN: Cannot reference `module` type within a class body. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType2.pkl)
|
||||||
|
pkl: WARN: Cannot reference `module` type within a class body. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType2.pkl)
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
result = "ok"
|
|
||||||
+13
@@ -0,0 +1,13 @@
|
|||||||
|
qux = false
|
||||||
|
corge {
|
||||||
|
grault {
|
||||||
|
garply = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pkl: WARN: Cannot reference `module` type within an annotation body. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType4.pkl)
|
||||||
|
pkl: WARN: Cannot reference `module` type within a class body. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType4.pkl)
|
||||||
|
pkl: WARN: Cannot reference `module` type within a type alias body. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType4.pkl)
|
||||||
|
pkl: WARN: Cannot reference `module` type from const property `currentModuleType4#qux`. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType4.pkl)
|
||||||
|
pkl: WARN: Cannot reference `module` type from const property `currentModuleType4#corge`. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType4.pkl)
|
||||||
|
pkl: WARN: Cannot reference `module` type from const property `currentModuleType4#waldo`. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType4.pkl)
|
||||||
|
pkl: WARN: Cannot reference `module` type from const method `currentModuleType4#quux`. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType4.pkl)
|
||||||
+2
@@ -0,0 +1,2 @@
|
|||||||
|
x = 1
|
||||||
|
y = 1
|
||||||
+19
@@ -0,0 +1,19 @@
|
|||||||
|
x = -1
|
||||||
|
res1 {
|
||||||
|
x = 1
|
||||||
|
y = 1
|
||||||
|
modName = "moduleTypeProperty"
|
||||||
|
}
|
||||||
|
res2 {
|
||||||
|
x = 1
|
||||||
|
y = 2
|
||||||
|
modName = "moduleTypeProperty"
|
||||||
|
}
|
||||||
|
res3 {
|
||||||
|
x = 2
|
||||||
|
y = 2
|
||||||
|
modName = "currentModuleType6#ModuleSubclass"
|
||||||
|
mod2x = -1
|
||||||
|
}
|
||||||
|
res4 = "Expected value of type `currentModuleType6#ModuleSubclass`, but got type `moduleTypeProperty`. Value: new ModuleClass { x = ?; y = ?; modName = ? }"
|
||||||
|
pkl: WARN: Cannot reference `module` type within a class body. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType6.pkl)
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
res1a = 1
|
||||||
|
res1b = 2
|
||||||
|
res1c = 3
|
||||||
|
res1d = 2
|
||||||
|
res1e = 4
|
||||||
|
res4 = null
|
||||||
|
res7 = "Expected value of type `thisType1#Bad`, but got type `String`. Value: \"abc\""
|
||||||
|
res8 = "Expected value of type `thisType1#Bad`, but got type `thisType1#Person`. Value: new Person {}"
|
||||||
|
res9 = "Expected value of type `thisType1#Bad`, but got type `thisType1#Person`. Value: new Person {}"
|
||||||
|
res10 = "Expected value of type `thisType1#Bad`, but got type `thisType1#Person`. Value: new Person {}"
|
||||||
|
res11a = 2
|
||||||
|
res11b = 3
|
||||||
|
res11c = 4
|
||||||
|
res11d = 4
|
||||||
|
res12 = "Expected value of type `thisType1#Good`, but got type `thisType1`. Value: new ModuleClass { res1a = 1; res1b = 2; res1c = 3; res1d = 2; res1e = 4; res4..."
|
||||||
|
res13a = 1
|
||||||
|
res14 = List(3)
|
||||||
|
res14a = "Expected value of type `thisType1#Good`, but got type `thisType1`. Value: new ModuleClass { res1a = 1; res1b = 2; res1c = 3; res1d = 2; res1e = 4; res4..."
|
||||||
|
res14b = 5
|
||||||
|
res15 = List(new {
|
||||||
|
x = 3
|
||||||
|
})
|
||||||
|
res15a = "Expected value of type `thisType1#B`, but got type `thisType1#A`. Value: new A { x = 1 }"
|
||||||
|
res15b = List(new {
|
||||||
|
x = 3
|
||||||
|
})
|
||||||
|
res16 = 5
|
||||||
|
res16a = "Expected value of type `thisType1`, but got type `Dynamic`. Value: new Dynamic { x = ? }"
|
||||||
|
res17 = 3
|
||||||
|
res18 {
|
||||||
|
1
|
||||||
|
}
|
||||||
|
res19 {
|
||||||
|
baz {
|
||||||
|
x = 3
|
||||||
|
}
|
||||||
|
}
|
||||||
|
res20a = 6
|
||||||
|
res21a = 6
|
||||||
|
res22a {
|
||||||
|
"thisType1: 1"
|
||||||
|
"thisType1#Good: 2"
|
||||||
|
"thisType1: 3"
|
||||||
|
"thisType1#Good: 4"
|
||||||
|
}
|
||||||
|
res22b {
|
||||||
|
"thisType1#Good: 1"
|
||||||
|
"thisType1#Good: 2"
|
||||||
|
"thisType1#Good: 3"
|
||||||
|
"thisType1#Good: 4"
|
||||||
|
}
|
||||||
|
res23 {
|
||||||
|
y = 2
|
||||||
|
}
|
||||||
|
res23a = "thisType1#ThisAnnotation"
|
||||||
|
res23b = "thisType1#ThisAnnotation"
|
||||||
|
res24 {
|
||||||
|
y = 2
|
||||||
|
}
|
||||||
|
res24a = "thisType1#ThatAnnotation"
|
||||||
|
res24b = "thisType1#ThisAnnotation"
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
–– Pkl Error ––
|
||||||
|
Cannot reference `this` type within a type alias body.
|
||||||
|
|
||||||
|
x | typealias Foo = this
|
||||||
|
^^^^
|
||||||
|
at thisType2#Foo (file:///$snippetsDir/input/types/thisType2.pkl)
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
res1 = 1
|
||||||
|
res2 {
|
||||||
|
new {
|
||||||
|
"hello"
|
||||||
|
}
|
||||||
|
new {
|
||||||
|
["hello"] = "world"
|
||||||
|
}
|
||||||
|
new {
|
||||||
|
res1 = 1
|
||||||
|
res2 = "blah"
|
||||||
|
}
|
||||||
|
123
|
||||||
|
false
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
res1 = 1
|
||||||
|
res2 {
|
||||||
|
new {
|
||||||
|
"hello"
|
||||||
|
}
|
||||||
|
new {
|
||||||
|
["hello"] = "world"
|
||||||
|
}
|
||||||
|
new {
|
||||||
|
res1 = 1
|
||||||
|
res2 = "blah"
|
||||||
|
}
|
||||||
|
123
|
||||||
|
false
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
res1 {
|
||||||
|
bar = null
|
||||||
|
baz = true
|
||||||
|
}
|
||||||
|
res2 = true
|
||||||
|
res3 {
|
||||||
|
bar {
|
||||||
|
bar = null
|
||||||
|
baz = true
|
||||||
|
}
|
||||||
|
baz = true
|
||||||
|
}
|
||||||
|
res4 = true
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
–– Pkl Error ––
|
||||||
|
`this` is not a valid supertype.
|
||||||
|
|
||||||
|
x | class Foo extends this
|
||||||
|
^^^^
|
||||||
|
at thisType6#Foo (file:///$snippetsDir/input/types/thisType6.pkl)
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
pkl: WARN: Cannot reference `module` type within a type alias body. This will be an error in a future release. (file:///$snippetsDir/input-helper/types/typeAliasModule.pkl)
|
||||||
–– Pkl Error ––
|
–– Pkl Error ––
|
||||||
Expected value of type `typeAliasModule`, but got type `typeAlias6`.
|
Expected value of type `typeAliasModule`, but got type `typeAlias6`.
|
||||||
Value: new ModuleClass { res = ? }
|
Value: new ModuleClass { res = ? }
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
|
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -468,6 +468,9 @@ private fun findTypesUsedBy(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
PType.THIS -> {
|
||||||
|
// do nothing, the enclosing PType.Class has already been visited
|
||||||
|
}
|
||||||
PType.NOTHING -> {}
|
PType.NOTHING -> {}
|
||||||
is PType.Nullable -> {
|
is PType.Nullable -> {
|
||||||
findTypesUsedBy(type.baseType, enclosingType, enclosingPackage, result)
|
findTypesUsedBy(type.baseType, enclosingType, enclosingPackage, result)
|
||||||
|
|||||||
@@ -347,6 +347,9 @@ internal abstract class PageGenerator<out S>(
|
|||||||
PType.MODULE -> {
|
PType.MODULE -> {
|
||||||
+"module"
|
+"module"
|
||||||
}
|
}
|
||||||
|
PType.THIS -> {
|
||||||
|
+"this"
|
||||||
|
}
|
||||||
is PType.StringLiteral -> {
|
is PType.StringLiteral -> {
|
||||||
+"\"${type.literal}\""
|
+"\"${type.literal}\""
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -343,6 +343,9 @@ internal class SearchIndexGenerator(private val outputDir: Path, consoleOut: Out
|
|||||||
PType.MODULE -> {
|
PType.MODULE -> {
|
||||||
append("module")
|
append("module")
|
||||||
}
|
}
|
||||||
|
PType.THIS -> {
|
||||||
|
append("this")
|
||||||
|
}
|
||||||
is PType.StringLiteral -> {
|
is PType.StringLiteral -> {
|
||||||
append("\\\"${type.literal}\\\"")
|
append("\\\"${type.literal}\\\"")
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -78,7 +78,7 @@ command line.</p></div>
|
|||||||
<div class="member-modifiers">function </div>
|
<div class="member-modifiers">function </div>
|
||||||
</div>
|
</div>
|
||||||
<div class="member-main">
|
<div class="member-main">
|
||||||
<div class="member-signature"><span class="name-decl">getClass</span>(): <a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Class.html" class="name-ref">Class</a><span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
<div class="member-signature"><span class="name-decl">getClass</span>(): <a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Class.html" class="name-ref">Class</a><this><span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
||||||
<div class="doc-comment"><p>Returns the class of <code>this</code>.</p></div>
|
<div class="doc-comment"><p>Returns the class of <code>this</code>.</p></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -105,7 +105,7 @@ command line.</p></div>
|
|||||||
<div class="member-modifiers">function </div>
|
<div class="member-modifiers">function </div>
|
||||||
</div>
|
</div>
|
||||||
<div class="member-main">
|
<div class="member-main">
|
||||||
<div class="member-signature"><span class="name-decl">ifNonNull</span><<a class="param1">Result</a>>(<span class="param2">transform</span>: (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html#NonNull" class="name-ref">NonNull</a>) -> <a href="index.html#ifNonNull().Result" class="name-ref">Result</a>): <a href="index.html#ifNonNull().Result" class="name-ref">Result</a>?<span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
<div class="member-signature"><span class="name-decl">ifNonNull</span><<a class="param1">Result</a>>(<span class="param2">transform</span>: (this) -> <a href="index.html#ifNonNull().Result" class="name-ref">Result</a>): <a href="index.html#ifNonNull().Result" class="name-ref">Result</a>?<span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
||||||
<div class="doc-comment"><p>Returns <code>this |> transform</code> if <code>this</code> is non-null, and <code>null</code> otherwise.</p></div>
|
<div class="doc-comment"><p>Returns <code>this |> transform</code> if <code>this</code> is non-null, and <code>null</code> otherwise.</p></div>
|
||||||
<div class="doc-comment expandable hidden collapsed"><p>This method is the complement of the <code>??</code> operator and the equivalent of an <code>Option</code> type's
|
<div class="doc-comment expandable hidden collapsed"><p>This method is the complement of the <code>??</code> operator and the equivalent of an <code>Option</code> type's
|
||||||
<code>map</code> and <code>flatMap</code> methods.</p></div>
|
<code>map</code> and <code>flatMap</code> methods.</p></div>
|
||||||
|
|||||||
Vendored
+2
-2
@@ -52,7 +52,7 @@
|
|||||||
<div class="member-modifiers">function </div>
|
<div class="member-modifiers">function </div>
|
||||||
</div>
|
</div>
|
||||||
<div class="member-main">
|
<div class="member-main">
|
||||||
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">getClass</span>(): <a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Class.html" class="name-ref">Class</a><span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">getClass</span>(): <a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Class.html" class="name-ref">Class</a><this><span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
||||||
<div class="doc-comment"><p>Returns the class of <code>this</code>.</p></div>
|
<div class="doc-comment"><p>Returns the class of <code>this</code>.</p></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -79,7 +79,7 @@
|
|||||||
<div class="member-modifiers">function </div>
|
<div class="member-modifiers">function </div>
|
||||||
</div>
|
</div>
|
||||||
<div class="member-main">
|
<div class="member-main">
|
||||||
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">ifNonNull</span><<a class="param1">Result</a>>(<span class="param2">transform</span>: (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html#NonNull" class="name-ref">NonNull</a>) -> <a href="BaseClass.html#ifNonNull().Result" class="name-ref">Result</a>): <a href="BaseClass.html#ifNonNull().Result" class="name-ref">Result</a>?<span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">ifNonNull</span><<a class="param1">Result</a>>(<span class="param2">transform</span>: (this) -> <a href="BaseClass.html#ifNonNull().Result" class="name-ref">Result</a>): <a href="BaseClass.html#ifNonNull().Result" class="name-ref">Result</a>?<span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
||||||
<div class="doc-comment"><p>Returns <code>this |> transform</code> if <code>this</code> is non-null, and <code>null</code> otherwise.</p></div>
|
<div class="doc-comment"><p>Returns <code>this |> transform</code> if <code>this</code> is non-null, and <code>null</code> otherwise.</p></div>
|
||||||
<div class="doc-comment expandable hidden collapsed"><p>This method is the complement of the <code>??</code> operator and the equivalent of an <code>Option</code> type's
|
<div class="doc-comment expandable hidden collapsed"><p>This method is the complement of the <code>??</code> operator and the equivalent of an <code>Option</code> type's
|
||||||
<code>map</code> and <code>flatMap</code> methods.</p></div>
|
<code>map</code> and <code>flatMap</code> methods.</p></div>
|
||||||
|
|||||||
Vendored
+2
-2
@@ -89,7 +89,7 @@ command line.</p></div>
|
|||||||
<div class="member-modifiers">function </div>
|
<div class="member-modifiers">function </div>
|
||||||
</div>
|
</div>
|
||||||
<div class="member-main">
|
<div class="member-main">
|
||||||
<div class="member-signature"><span class="name-decl">getClass</span>(): <a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Class.html" class="name-ref">Class</a><span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
<div class="member-signature"><span class="name-decl">getClass</span>(): <a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Class.html" class="name-ref">Class</a><this><span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
||||||
<div class="doc-comment"><p>Returns the class of <code>this</code>.</p></div>
|
<div class="doc-comment"><p>Returns the class of <code>this</code>.</p></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -116,7 +116,7 @@ command line.</p></div>
|
|||||||
<div class="member-modifiers">function </div>
|
<div class="member-modifiers">function </div>
|
||||||
</div>
|
</div>
|
||||||
<div class="member-main">
|
<div class="member-main">
|
||||||
<div class="member-signature"><span class="name-decl">ifNonNull</span><<a class="param1">Result</a>>(<span class="param2">transform</span>: (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html#NonNull" class="name-ref">NonNull</a>) -> <a href="index.html#ifNonNull().Result" class="name-ref">Result</a>): <a href="index.html#ifNonNull().Result" class="name-ref">Result</a>?<span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
<div class="member-signature"><span class="name-decl">ifNonNull</span><<a class="param1">Result</a>>(<span class="param2">transform</span>: (this) -> <a href="index.html#ifNonNull().Result" class="name-ref">Result</a>): <a href="index.html#ifNonNull().Result" class="name-ref">Result</a>?<span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
||||||
<div class="doc-comment"><p>Returns <code>this |> transform</code> if <code>this</code> is non-null, and <code>null</code> otherwise.</p></div>
|
<div class="doc-comment"><p>Returns <code>this |> transform</code> if <code>this</code> is non-null, and <code>null</code> otherwise.</p></div>
|
||||||
<div class="doc-comment expandable hidden collapsed"><p>This method is the complement of the <code>??</code> operator and the equivalent of an <code>Option</code> type's
|
<div class="doc-comment expandable hidden collapsed"><p>This method is the complement of the <code>??</code> operator and the equivalent of an <code>Option</code> type's
|
||||||
<code>map</code> and <code>flatMap</code> methods.</p></div>
|
<code>map</code> and <code>flatMap</code> methods.</p></div>
|
||||||
|
|||||||
+2
-2
@@ -55,7 +55,7 @@
|
|||||||
<div class="member-modifiers">function </div>
|
<div class="member-modifiers">function </div>
|
||||||
</div>
|
</div>
|
||||||
<div class="member-main">
|
<div class="member-main">
|
||||||
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">getClass</span>(): <a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Class.html" class="name-ref">Class</a><span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">getClass</span>(): <a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Class.html" class="name-ref">Class</a><this><span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
||||||
<div class="doc-comment"><p>Returns the class of <code>this</code>.</p></div>
|
<div class="doc-comment"><p>Returns the class of <code>this</code>.</p></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -82,7 +82,7 @@
|
|||||||
<div class="member-modifiers">function </div>
|
<div class="member-modifiers">function </div>
|
||||||
</div>
|
</div>
|
||||||
<div class="member-main">
|
<div class="member-main">
|
||||||
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">ifNonNull</span><<a class="param1">Result</a>>(<span class="param2">transform</span>: (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html#NonNull" class="name-ref">NonNull</a>) -> <a href="AnnotatedClass.html#ifNonNull().Result" class="name-ref">Result</a>): <a href="AnnotatedClass.html#ifNonNull().Result" class="name-ref">Result</a>?<span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">ifNonNull</span><<a class="param1">Result</a>>(<span class="param2">transform</span>: (this) -> <a href="AnnotatedClass.html#ifNonNull().Result" class="name-ref">Result</a>): <a href="AnnotatedClass.html#ifNonNull().Result" class="name-ref">Result</a>?<span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
||||||
<div class="doc-comment"><p>Returns <code>this |> transform</code> if <code>this</code> is non-null, and <code>null</code> otherwise.</p></div>
|
<div class="doc-comment"><p>Returns <code>this |> transform</code> if <code>this</code> is non-null, and <code>null</code> otherwise.</p></div>
|
||||||
<div class="doc-comment expandable hidden collapsed"><p>This method is the complement of the <code>??</code> operator and the equivalent of an <code>Option</code> type's
|
<div class="doc-comment expandable hidden collapsed"><p>This method is the complement of the <code>??</code> operator and the equivalent of an <code>Option</code> type's
|
||||||
<code>map</code> and <code>flatMap</code> methods.</p></div>
|
<code>map</code> and <code>flatMap</code> methods.</p></div>
|
||||||
|
|||||||
+2
-2
@@ -57,7 +57,7 @@
|
|||||||
<div class="member-modifiers">function </div>
|
<div class="member-modifiers">function </div>
|
||||||
</div>
|
</div>
|
||||||
<div class="member-main">
|
<div class="member-main">
|
||||||
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">getClass</span>(): <a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Class.html" class="name-ref">Class</a><span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">getClass</span>(): <a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Class.html" class="name-ref">Class</a><this><span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
||||||
<div class="doc-comment"><p>Returns the class of <code>this</code>.</p></div>
|
<div class="doc-comment"><p>Returns the class of <code>this</code>.</p></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -84,7 +84,7 @@
|
|||||||
<div class="member-modifiers">function </div>
|
<div class="member-modifiers">function </div>
|
||||||
</div>
|
</div>
|
||||||
<div class="member-main">
|
<div class="member-main">
|
||||||
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">ifNonNull</span><<a class="param1">Result</a>>(<span class="param2">transform</span>: (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html#NonNull" class="name-ref">NonNull</a>) -> <a href="AnnotatedClss.html#ifNonNull().Result" class="name-ref">Result</a>): <a href="AnnotatedClss.html#ifNonNull().Result" class="name-ref">Result</a>?<span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">ifNonNull</span><<a class="param1">Result</a>>(<span class="param2">transform</span>: (this) -> <a href="AnnotatedClss.html#ifNonNull().Result" class="name-ref">Result</a>): <a href="AnnotatedClss.html#ifNonNull().Result" class="name-ref">Result</a>?<span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
||||||
<div class="doc-comment"><p>Returns <code>this |> transform</code> if <code>this</code> is non-null, and <code>null</code> otherwise.</p></div>
|
<div class="doc-comment"><p>Returns <code>this |> transform</code> if <code>this</code> is non-null, and <code>null</code> otherwise.</p></div>
|
||||||
<div class="doc-comment expandable hidden collapsed"><p>This method is the complement of the <code>??</code> operator and the equivalent of an <code>Option</code> type's
|
<div class="doc-comment expandable hidden collapsed"><p>This method is the complement of the <code>??</code> operator and the equivalent of an <code>Option</code> type's
|
||||||
<code>map</code> and <code>flatMap</code> methods.</p></div>
|
<code>map</code> and <code>flatMap</code> methods.</p></div>
|
||||||
|
|||||||
+2
-2
@@ -57,7 +57,7 @@
|
|||||||
<div class="member-modifiers">function </div>
|
<div class="member-modifiers">function </div>
|
||||||
</div>
|
</div>
|
||||||
<div class="member-main">
|
<div class="member-main">
|
||||||
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">getClass</span>(): <a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Class.html" class="name-ref">Class</a><span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">getClass</span>(): <a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Class.html" class="name-ref">Class</a><this><span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
||||||
<div class="doc-comment"><p>Returns the class of <code>this</code>.</p></div>
|
<div class="doc-comment"><p>Returns the class of <code>this</code>.</p></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -84,7 +84,7 @@
|
|||||||
<div class="member-modifiers">function </div>
|
<div class="member-modifiers">function </div>
|
||||||
</div>
|
</div>
|
||||||
<div class="member-main">
|
<div class="member-main">
|
||||||
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">ifNonNull</span><<a class="param1">Result</a>>(<span class="param2">transform</span>: (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html#NonNull" class="name-ref">NonNull</a>) -> <a href="AnnotatedClssWithExpandableComment.html#ifNonNull().Result" class="name-ref">Result</a>): <a href="AnnotatedClssWithExpandableComment.html#ifNonNull().Result" class="name-ref">Result</a>?<span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">ifNonNull</span><<a class="param1">Result</a>>(<span class="param2">transform</span>: (this) -> <a href="AnnotatedClssWithExpandableComment.html#ifNonNull().Result" class="name-ref">Result</a>): <a href="AnnotatedClssWithExpandableComment.html#ifNonNull().Result" class="name-ref">Result</a>?<span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
||||||
<div class="doc-comment"><p>Returns <code>this |> transform</code> if <code>this</code> is non-null, and <code>null</code> otherwise.</p></div>
|
<div class="doc-comment"><p>Returns <code>this |> transform</code> if <code>this</code> is non-null, and <code>null</code> otherwise.</p></div>
|
||||||
<div class="doc-comment expandable hidden collapsed"><p>This method is the complement of the <code>??</code> operator and the equivalent of an <code>Option</code> type's
|
<div class="doc-comment expandable hidden collapsed"><p>This method is the complement of the <code>??</code> operator and the equivalent of an <code>Option</code> type's
|
||||||
<code>map</code> and <code>flatMap</code> methods.</p></div>
|
<code>map</code> and <code>flatMap</code> methods.</p></div>
|
||||||
|
|||||||
Vendored
+2
-2
@@ -78,7 +78,7 @@ command line.</p></div>
|
|||||||
<div class="member-modifiers">function </div>
|
<div class="member-modifiers">function </div>
|
||||||
</div>
|
</div>
|
||||||
<div class="member-main">
|
<div class="member-main">
|
||||||
<div class="member-signature"><span class="name-decl">getClass</span>(): <a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Class.html" class="name-ref">Class</a><span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
<div class="member-signature"><span class="name-decl">getClass</span>(): <a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Class.html" class="name-ref">Class</a><this><span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
||||||
<div class="doc-comment"><p>Returns the class of <code>this</code>.</p></div>
|
<div class="doc-comment"><p>Returns the class of <code>this</code>.</p></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -105,7 +105,7 @@ command line.</p></div>
|
|||||||
<div class="member-modifiers">function </div>
|
<div class="member-modifiers">function </div>
|
||||||
</div>
|
</div>
|
||||||
<div class="member-main">
|
<div class="member-main">
|
||||||
<div class="member-signature"><span class="name-decl">ifNonNull</span><<a class="param1">Result</a>>(<span class="param2">transform</span>: (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html#NonNull" class="name-ref">NonNull</a>) -> <a href="index.html#ifNonNull().Result" class="name-ref">Result</a>): <a href="index.html#ifNonNull().Result" class="name-ref">Result</a>?<span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
<div class="member-signature"><span class="name-decl">ifNonNull</span><<a class="param1">Result</a>>(<span class="param2">transform</span>: (this) -> <a href="index.html#ifNonNull().Result" class="name-ref">Result</a>): <a href="index.html#ifNonNull().Result" class="name-ref">Result</a>?<span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
||||||
<div class="doc-comment"><p>Returns <code>this |> transform</code> if <code>this</code> is non-null, and <code>null</code> otherwise.</p></div>
|
<div class="doc-comment"><p>Returns <code>this |> transform</code> if <code>this</code> is non-null, and <code>null</code> otherwise.</p></div>
|
||||||
<div class="doc-comment expandable hidden collapsed"><p>This method is the complement of the <code>??</code> operator and the equivalent of an <code>Option</code> type's
|
<div class="doc-comment expandable hidden collapsed"><p>This method is the complement of the <code>??</code> operator and the equivalent of an <code>Option</code> type's
|
||||||
<code>map</code> and <code>flatMap</code> methods.</p></div>
|
<code>map</code> and <code>flatMap</code> methods.</p></div>
|
||||||
|
|||||||
pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classComments/Comments1.html
Vendored
+2
-2
@@ -52,7 +52,7 @@
|
|||||||
<div class="member-modifiers">function </div>
|
<div class="member-modifiers">function </div>
|
||||||
</div>
|
</div>
|
||||||
<div class="member-main">
|
<div class="member-main">
|
||||||
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">getClass</span>(): <a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Class.html" class="name-ref">Class</a><span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">getClass</span>(): <a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Class.html" class="name-ref">Class</a><this><span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
||||||
<div class="doc-comment"><p>Returns the class of <code>this</code>.</p></div>
|
<div class="doc-comment"><p>Returns the class of <code>this</code>.</p></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -79,7 +79,7 @@
|
|||||||
<div class="member-modifiers">function </div>
|
<div class="member-modifiers">function </div>
|
||||||
</div>
|
</div>
|
||||||
<div class="member-main">
|
<div class="member-main">
|
||||||
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">ifNonNull</span><<a class="param1">Result</a>>(<span class="param2">transform</span>: (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html#NonNull" class="name-ref">NonNull</a>) -> <a href="Comments1.html#ifNonNull().Result" class="name-ref">Result</a>): <a href="Comments1.html#ifNonNull().Result" class="name-ref">Result</a>?<span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">ifNonNull</span><<a class="param1">Result</a>>(<span class="param2">transform</span>: (this) -> <a href="Comments1.html#ifNonNull().Result" class="name-ref">Result</a>): <a href="Comments1.html#ifNonNull().Result" class="name-ref">Result</a>?<span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
||||||
<div class="doc-comment"><p>Returns <code>this |> transform</code> if <code>this</code> is non-null, and <code>null</code> otherwise.</p></div>
|
<div class="doc-comment"><p>Returns <code>this |> transform</code> if <code>this</code> is non-null, and <code>null</code> otherwise.</p></div>
|
||||||
<div class="doc-comment expandable hidden collapsed"><p>This method is the complement of the <code>??</code> operator and the equivalent of an <code>Option</code> type's
|
<div class="doc-comment expandable hidden collapsed"><p>This method is the complement of the <code>??</code> operator and the equivalent of an <code>Option</code> type's
|
||||||
<code>map</code> and <code>flatMap</code> methods.</p></div>
|
<code>map</code> and <code>flatMap</code> methods.</p></div>
|
||||||
|
|||||||
pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classComments/Comments2.html
Vendored
+2
-2
@@ -52,7 +52,7 @@
|
|||||||
<div class="member-modifiers">function </div>
|
<div class="member-modifiers">function </div>
|
||||||
</div>
|
</div>
|
||||||
<div class="member-main">
|
<div class="member-main">
|
||||||
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">getClass</span>(): <a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Class.html" class="name-ref">Class</a><span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">getClass</span>(): <a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Class.html" class="name-ref">Class</a><this><span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
||||||
<div class="doc-comment"><p>Returns the class of <code>this</code>.</p></div>
|
<div class="doc-comment"><p>Returns the class of <code>this</code>.</p></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -79,7 +79,7 @@
|
|||||||
<div class="member-modifiers">function </div>
|
<div class="member-modifiers">function </div>
|
||||||
</div>
|
</div>
|
||||||
<div class="member-main">
|
<div class="member-main">
|
||||||
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">ifNonNull</span><<a class="param1">Result</a>>(<span class="param2">transform</span>: (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html#NonNull" class="name-ref">NonNull</a>) -> <a href="Comments2.html#ifNonNull().Result" class="name-ref">Result</a>): <a href="Comments2.html#ifNonNull().Result" class="name-ref">Result</a>?<span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">ifNonNull</span><<a class="param1">Result</a>>(<span class="param2">transform</span>: (this) -> <a href="Comments2.html#ifNonNull().Result" class="name-ref">Result</a>): <a href="Comments2.html#ifNonNull().Result" class="name-ref">Result</a>?<span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
||||||
<div class="doc-comment"><p>Returns <code>this |> transform</code> if <code>this</code> is non-null, and <code>null</code> otherwise.</p></div>
|
<div class="doc-comment"><p>Returns <code>this |> transform</code> if <code>this</code> is non-null, and <code>null</code> otherwise.</p></div>
|
||||||
<div class="doc-comment expandable hidden collapsed"><p>This method is the complement of the <code>??</code> operator and the equivalent of an <code>Option</code> type's
|
<div class="doc-comment expandable hidden collapsed"><p>This method is the complement of the <code>??</code> operator and the equivalent of an <code>Option</code> type's
|
||||||
<code>map</code> and <code>flatMap</code> methods.</p></div>
|
<code>map</code> and <code>flatMap</code> methods.</p></div>
|
||||||
|
|||||||
pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classComments/Comments3.html
Vendored
+2
-2
@@ -53,7 +53,7 @@
|
|||||||
<div class="member-modifiers">function </div>
|
<div class="member-modifiers">function </div>
|
||||||
</div>
|
</div>
|
||||||
<div class="member-main">
|
<div class="member-main">
|
||||||
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">getClass</span>(): <a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Class.html" class="name-ref">Class</a><span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">getClass</span>(): <a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Class.html" class="name-ref">Class</a><this><span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
||||||
<div class="doc-comment"><p>Returns the class of <code>this</code>.</p></div>
|
<div class="doc-comment"><p>Returns the class of <code>this</code>.</p></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -80,7 +80,7 @@
|
|||||||
<div class="member-modifiers">function </div>
|
<div class="member-modifiers">function </div>
|
||||||
</div>
|
</div>
|
||||||
<div class="member-main">
|
<div class="member-main">
|
||||||
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">ifNonNull</span><<a class="param1">Result</a>>(<span class="param2">transform</span>: (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html#NonNull" class="name-ref">NonNull</a>) -> <a href="Comments3.html#ifNonNull().Result" class="name-ref">Result</a>): <a href="Comments3.html#ifNonNull().Result" class="name-ref">Result</a>?<span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">ifNonNull</span><<a class="param1">Result</a>>(<span class="param2">transform</span>: (this) -> <a href="Comments3.html#ifNonNull().Result" class="name-ref">Result</a>): <a href="Comments3.html#ifNonNull().Result" class="name-ref">Result</a>?<span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
||||||
<div class="doc-comment"><p>Returns <code>this |> transform</code> if <code>this</code> is non-null, and <code>null</code> otherwise.</p></div>
|
<div class="doc-comment"><p>Returns <code>this |> transform</code> if <code>this</code> is non-null, and <code>null</code> otherwise.</p></div>
|
||||||
<div class="doc-comment expandable hidden collapsed"><p>This method is the complement of the <code>??</code> operator and the equivalent of an <code>Option</code> type's
|
<div class="doc-comment expandable hidden collapsed"><p>This method is the complement of the <code>??</code> operator and the equivalent of an <code>Option</code> type's
|
||||||
<code>map</code> and <code>flatMap</code> methods.</p></div>
|
<code>map</code> and <code>flatMap</code> methods.</p></div>
|
||||||
|
|||||||
pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classComments/Comments4.html
Vendored
+2
-2
@@ -57,7 +57,7 @@ Class with multi-line and multi-paragraph doc comment (paragraph2, line2).</p></
|
|||||||
<div class="member-modifiers">function </div>
|
<div class="member-modifiers">function </div>
|
||||||
</div>
|
</div>
|
||||||
<div class="member-main">
|
<div class="member-main">
|
||||||
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">getClass</span>(): <a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Class.html" class="name-ref">Class</a><span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">getClass</span>(): <a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Class.html" class="name-ref">Class</a><this><span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
||||||
<div class="doc-comment"><p>Returns the class of <code>this</code>.</p></div>
|
<div class="doc-comment"><p>Returns the class of <code>this</code>.</p></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -84,7 +84,7 @@ Class with multi-line and multi-paragraph doc comment (paragraph2, line2).</p></
|
|||||||
<div class="member-modifiers">function </div>
|
<div class="member-modifiers">function </div>
|
||||||
</div>
|
</div>
|
||||||
<div class="member-main">
|
<div class="member-main">
|
||||||
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">ifNonNull</span><<a class="param1">Result</a>>(<span class="param2">transform</span>: (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html#NonNull" class="name-ref">NonNull</a>) -> <a href="Comments4.html#ifNonNull().Result" class="name-ref">Result</a>): <a href="Comments4.html#ifNonNull().Result" class="name-ref">Result</a>?<span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">ifNonNull</span><<a class="param1">Result</a>>(<span class="param2">transform</span>: (this) -> <a href="Comments4.html#ifNonNull().Result" class="name-ref">Result</a>): <a href="Comments4.html#ifNonNull().Result" class="name-ref">Result</a>?<span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
||||||
<div class="doc-comment"><p>Returns <code>this |> transform</code> if <code>this</code> is non-null, and <code>null</code> otherwise.</p></div>
|
<div class="doc-comment"><p>Returns <code>this |> transform</code> if <code>this</code> is non-null, and <code>null</code> otherwise.</p></div>
|
||||||
<div class="doc-comment expandable hidden collapsed"><p>This method is the complement of the <code>??</code> operator and the equivalent of an <code>Option</code> type's
|
<div class="doc-comment expandable hidden collapsed"><p>This method is the complement of the <code>??</code> operator and the equivalent of an <code>Option</code> type's
|
||||||
<code>map</code> and <code>flatMap</code> methods.</p></div>
|
<code>map</code> and <code>flatMap</code> methods.</p></div>
|
||||||
|
|||||||
pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classComments/Comments5.html
Vendored
+2
-2
@@ -53,7 +53,7 @@
|
|||||||
<div class="member-modifiers">function </div>
|
<div class="member-modifiers">function </div>
|
||||||
</div>
|
</div>
|
||||||
<div class="member-main">
|
<div class="member-main">
|
||||||
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">getClass</span>(): <a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Class.html" class="name-ref">Class</a><span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">getClass</span>(): <a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Class.html" class="name-ref">Class</a><this><span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
||||||
<div class="doc-comment"><p>Returns the class of <code>this</code>.</p></div>
|
<div class="doc-comment"><p>Returns the class of <code>this</code>.</p></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -80,7 +80,7 @@
|
|||||||
<div class="member-modifiers">function </div>
|
<div class="member-modifiers">function </div>
|
||||||
</div>
|
</div>
|
||||||
<div class="member-main">
|
<div class="member-main">
|
||||||
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">ifNonNull</span><<a class="param1">Result</a>>(<span class="param2">transform</span>: (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html#NonNull" class="name-ref">NonNull</a>) -> <a href="Comments5.html#ifNonNull().Result" class="name-ref">Result</a>): <a href="Comments5.html#ifNonNull().Result" class="name-ref">Result</a>?<span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">ifNonNull</span><<a class="param1">Result</a>>(<span class="param2">transform</span>: (this) -> <a href="Comments5.html#ifNonNull().Result" class="name-ref">Result</a>): <a href="Comments5.html#ifNonNull().Result" class="name-ref">Result</a>?<span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
||||||
<div class="doc-comment"><p>Returns <code>this |> transform</code> if <code>this</code> is non-null, and <code>null</code> otherwise.</p></div>
|
<div class="doc-comment"><p>Returns <code>this |> transform</code> if <code>this</code> is non-null, and <code>null</code> otherwise.</p></div>
|
||||||
<div class="doc-comment expandable hidden collapsed"><p>This method is the complement of the <code>??</code> operator and the equivalent of an <code>Option</code> type's
|
<div class="doc-comment expandable hidden collapsed"><p>This method is the complement of the <code>??</code> operator and the equivalent of an <code>Option</code> type's
|
||||||
<code>map</code> and <code>flatMap</code> methods.</p></div>
|
<code>map</code> and <code>flatMap</code> methods.</p></div>
|
||||||
|
|||||||
pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classComments/Comments6.html
Vendored
+2
-2
@@ -55,7 +55,7 @@
|
|||||||
<div class="member-modifiers">function </div>
|
<div class="member-modifiers">function </div>
|
||||||
</div>
|
</div>
|
||||||
<div class="member-main">
|
<div class="member-main">
|
||||||
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">getClass</span>(): <a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Class.html" class="name-ref">Class</a><span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">getClass</span>(): <a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Class.html" class="name-ref">Class</a><this><span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
||||||
<div class="doc-comment"><p>Returns the class of <code>this</code>.</p></div>
|
<div class="doc-comment"><p>Returns the class of <code>this</code>.</p></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -82,7 +82,7 @@
|
|||||||
<div class="member-modifiers">function </div>
|
<div class="member-modifiers">function </div>
|
||||||
</div>
|
</div>
|
||||||
<div class="member-main">
|
<div class="member-main">
|
||||||
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">ifNonNull</span><<a class="param1">Result</a>>(<span class="param2">transform</span>: (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html#NonNull" class="name-ref">NonNull</a>) -> <a href="Comments6.html#ifNonNull().Result" class="name-ref">Result</a>): <a href="Comments6.html#ifNonNull().Result" class="name-ref">Result</a>?<span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">ifNonNull</span><<a class="param1">Result</a>>(<span class="param2">transform</span>: (this) -> <a href="Comments6.html#ifNonNull().Result" class="name-ref">Result</a>): <a href="Comments6.html#ifNonNull().Result" class="name-ref">Result</a>?<span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
||||||
<div class="doc-comment"><p>Returns <code>this |> transform</code> if <code>this</code> is non-null, and <code>null</code> otherwise.</p></div>
|
<div class="doc-comment"><p>Returns <code>this |> transform</code> if <code>this</code> is non-null, and <code>null</code> otherwise.</p></div>
|
||||||
<div class="doc-comment expandable hidden collapsed"><p>This method is the complement of the <code>??</code> operator and the equivalent of an <code>Option</code> type's
|
<div class="doc-comment expandable hidden collapsed"><p>This method is the complement of the <code>??</code> operator and the equivalent of an <code>Option</code> type's
|
||||||
<code>map</code> and <code>flatMap</code> methods.</p></div>
|
<code>map</code> and <code>flatMap</code> methods.</p></div>
|
||||||
|
|||||||
pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classComments/Comments7.html
Vendored
+2
-2
@@ -53,7 +53,7 @@
|
|||||||
<div class="member-modifiers">function </div>
|
<div class="member-modifiers">function </div>
|
||||||
</div>
|
</div>
|
||||||
<div class="member-main">
|
<div class="member-main">
|
||||||
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">getClass</span>(): <a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Class.html" class="name-ref">Class</a><span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">getClass</span>(): <a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Class.html" class="name-ref">Class</a><this><span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
||||||
<div class="doc-comment"><p>Returns the class of <code>this</code>.</p></div>
|
<div class="doc-comment"><p>Returns the class of <code>this</code>.</p></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -80,7 +80,7 @@
|
|||||||
<div class="member-modifiers">function </div>
|
<div class="member-modifiers">function </div>
|
||||||
</div>
|
</div>
|
||||||
<div class="member-main">
|
<div class="member-main">
|
||||||
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">ifNonNull</span><<a class="param1">Result</a>>(<span class="param2">transform</span>: (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html#NonNull" class="name-ref">NonNull</a>) -> <a href="Comments7.html#ifNonNull().Result" class="name-ref">Result</a>): <a href="Comments7.html#ifNonNull().Result" class="name-ref">Result</a>?<span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">ifNonNull</span><<a class="param1">Result</a>>(<span class="param2">transform</span>: (this) -> <a href="Comments7.html#ifNonNull().Result" class="name-ref">Result</a>): <a href="Comments7.html#ifNonNull().Result" class="name-ref">Result</a>?<span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
||||||
<div class="doc-comment"><p>Returns <code>this |> transform</code> if <code>this</code> is non-null, and <code>null</code> otherwise.</p></div>
|
<div class="doc-comment"><p>Returns <code>this |> transform</code> if <code>this</code> is non-null, and <code>null</code> otherwise.</p></div>
|
||||||
<div class="doc-comment expandable hidden collapsed"><p>This method is the complement of the <code>??</code> operator and the equivalent of an <code>Option</code> type's
|
<div class="doc-comment expandable hidden collapsed"><p>This method is the complement of the <code>??</code> operator and the equivalent of an <code>Option</code> type's
|
||||||
<code>map</code> and <code>flatMap</code> methods.</p></div>
|
<code>map</code> and <code>flatMap</code> methods.</p></div>
|
||||||
|
|||||||
pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classComments/Comments8.html
Vendored
+2
-2
@@ -104,7 +104,7 @@ class Person {
|
|||||||
<div class="member-modifiers">function </div>
|
<div class="member-modifiers">function </div>
|
||||||
</div>
|
</div>
|
||||||
<div class="member-main">
|
<div class="member-main">
|
||||||
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">getClass</span>(): <a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Class.html" class="name-ref">Class</a><span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">getClass</span>(): <a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Class.html" class="name-ref">Class</a><this><span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
||||||
<div class="doc-comment"><p>Returns the class of <code>this</code>.</p></div>
|
<div class="doc-comment"><p>Returns the class of <code>this</code>.</p></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -131,7 +131,7 @@ class Person {
|
|||||||
<div class="member-modifiers">function </div>
|
<div class="member-modifiers">function </div>
|
||||||
</div>
|
</div>
|
||||||
<div class="member-main">
|
<div class="member-main">
|
||||||
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">ifNonNull</span><<a class="param1">Result</a>>(<span class="param2">transform</span>: (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html#NonNull" class="name-ref">NonNull</a>) -> <a href="Comments8.html#ifNonNull().Result" class="name-ref">Result</a>): <a href="Comments8.html#ifNonNull().Result" class="name-ref">Result</a>?<span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">ifNonNull</span><<a class="param1">Result</a>>(<span class="param2">transform</span>: (this) -> <a href="Comments8.html#ifNonNull().Result" class="name-ref">Result</a>): <a href="Comments8.html#ifNonNull().Result" class="name-ref">Result</a>?<span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
||||||
<div class="doc-comment"><p>Returns <code>this |> transform</code> if <code>this</code> is non-null, and <code>null</code> otherwise.</p></div>
|
<div class="doc-comment"><p>Returns <code>this |> transform</code> if <code>this</code> is non-null, and <code>null</code> otherwise.</p></div>
|
||||||
<div class="doc-comment expandable hidden collapsed"><p>This method is the complement of the <code>??</code> operator and the equivalent of an <code>Option</code> type's
|
<div class="doc-comment expandable hidden collapsed"><p>This method is the complement of the <code>??</code> operator and the equivalent of an <code>Option</code> type's
|
||||||
<code>map</code> and <code>flatMap</code> methods.</p></div>
|
<code>map</code> and <code>flatMap</code> methods.</p></div>
|
||||||
|
|||||||
Vendored
+2
-2
@@ -148,7 +148,7 @@ command line.</p></div>
|
|||||||
<div class="member-modifiers">function </div>
|
<div class="member-modifiers">function </div>
|
||||||
</div>
|
</div>
|
||||||
<div class="member-main">
|
<div class="member-main">
|
||||||
<div class="member-signature"><span class="name-decl">getClass</span>(): <a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Class.html" class="name-ref">Class</a><span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
<div class="member-signature"><span class="name-decl">getClass</span>(): <a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Class.html" class="name-ref">Class</a><this><span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
||||||
<div class="doc-comment"><p>Returns the class of <code>this</code>.</p></div>
|
<div class="doc-comment"><p>Returns the class of <code>this</code>.</p></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -175,7 +175,7 @@ command line.</p></div>
|
|||||||
<div class="member-modifiers">function </div>
|
<div class="member-modifiers">function </div>
|
||||||
</div>
|
</div>
|
||||||
<div class="member-main">
|
<div class="member-main">
|
||||||
<div class="member-signature"><span class="name-decl">ifNonNull</span><<a class="param1">Result</a>>(<span class="param2">transform</span>: (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html#NonNull" class="name-ref">NonNull</a>) -> <a href="index.html#ifNonNull().Result" class="name-ref">Result</a>): <a href="index.html#ifNonNull().Result" class="name-ref">Result</a>?<span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
<div class="member-signature"><span class="name-decl">ifNonNull</span><<a class="param1">Result</a>>(<span class="param2">transform</span>: (this) -> <a href="index.html#ifNonNull().Result" class="name-ref">Result</a>): <a href="index.html#ifNonNull().Result" class="name-ref">Result</a>?<span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
||||||
<div class="doc-comment"><p>Returns <code>this |> transform</code> if <code>this</code> is non-null, and <code>null</code> otherwise.</p></div>
|
<div class="doc-comment"><p>Returns <code>this |> transform</code> if <code>this</code> is non-null, and <code>null</code> otherwise.</p></div>
|
||||||
<div class="doc-comment expandable hidden collapsed"><p>This method is the complement of the <code>??</code> operator and the equivalent of an <code>Option</code> type's
|
<div class="doc-comment expandable hidden collapsed"><p>This method is the complement of the <code>??</code> operator and the equivalent of an <code>Option</code> type's
|
||||||
<code>map</code> and <code>flatMap</code> methods.</p></div>
|
<code>map</code> and <code>flatMap</code> methods.</p></div>
|
||||||
|
|||||||
+2
-2
@@ -71,7 +71,7 @@
|
|||||||
<div class="member-modifiers">function </div>
|
<div class="member-modifiers">function </div>
|
||||||
</div>
|
</div>
|
||||||
<div class="member-main">
|
<div class="member-main">
|
||||||
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">getClass</span>(): <a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Class.html" class="name-ref">Class</a><span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">getClass</span>(): <a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Class.html" class="name-ref">Class</a><this><span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
||||||
<div class="doc-comment"><p>Returns the class of <code>this</code>.</p></div>
|
<div class="doc-comment"><p>Returns the class of <code>this</code>.</p></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -98,7 +98,7 @@
|
|||||||
<div class="member-modifiers">function </div>
|
<div class="member-modifiers">function </div>
|
||||||
</div>
|
</div>
|
||||||
<div class="member-main">
|
<div class="member-main">
|
||||||
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">ifNonNull</span><<a class="param1">Result</a>>(<span class="param2">transform</span>: (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html#NonNull" class="name-ref">NonNull</a>) -> <a href="MyClass1.html#ifNonNull().Result" class="name-ref">Result</a>): <a href="MyClass1.html#ifNonNull().Result" class="name-ref">Result</a>?<span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">ifNonNull</span><<a class="param1">Result</a>>(<span class="param2">transform</span>: (this) -> <a href="MyClass1.html#ifNonNull().Result" class="name-ref">Result</a>): <a href="MyClass1.html#ifNonNull().Result" class="name-ref">Result</a>?<span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
||||||
<div class="doc-comment"><p>Returns <code>this |> transform</code> if <code>this</code> is non-null, and <code>null</code> otherwise.</p></div>
|
<div class="doc-comment"><p>Returns <code>this |> transform</code> if <code>this</code> is non-null, and <code>null</code> otherwise.</p></div>
|
||||||
<div class="doc-comment expandable hidden collapsed"><p>This method is the complement of the <code>??</code> operator and the equivalent of an <code>Option</code> type's
|
<div class="doc-comment expandable hidden collapsed"><p>This method is the complement of the <code>??</code> operator and the equivalent of an <code>Option</code> type's
|
||||||
<code>map</code> and <code>flatMap</code> methods.</p></div>
|
<code>map</code> and <code>flatMap</code> methods.</p></div>
|
||||||
|
|||||||
+2
-2
@@ -82,7 +82,7 @@
|
|||||||
<div class="member-modifiers">function </div>
|
<div class="member-modifiers">function </div>
|
||||||
</div>
|
</div>
|
||||||
<div class="member-main">
|
<div class="member-main">
|
||||||
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">getClass</span>(): <a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Class.html" class="name-ref">Class</a><span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">getClass</span>(): <a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Class.html" class="name-ref">Class</a><this><span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
||||||
<div class="doc-comment"><p>Returns the class of <code>this</code>.</p></div>
|
<div class="doc-comment"><p>Returns the class of <code>this</code>.</p></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -109,7 +109,7 @@
|
|||||||
<div class="member-modifiers">function </div>
|
<div class="member-modifiers">function </div>
|
||||||
</div>
|
</div>
|
||||||
<div class="member-main">
|
<div class="member-main">
|
||||||
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">ifNonNull</span><<a class="param1">Result</a>>(<span class="param2">transform</span>: (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html#NonNull" class="name-ref">NonNull</a>) -> <a href="MyClass2.html#ifNonNull().Result" class="name-ref">Result</a>): <a href="MyClass2.html#ifNonNull().Result" class="name-ref">Result</a>?<span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">ifNonNull</span><<a class="param1">Result</a>>(<span class="param2">transform</span>: (this) -> <a href="MyClass2.html#ifNonNull().Result" class="name-ref">Result</a>): <a href="MyClass2.html#ifNonNull().Result" class="name-ref">Result</a>?<span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
||||||
<div class="doc-comment"><p>Returns <code>this |> transform</code> if <code>this</code> is non-null, and <code>null</code> otherwise.</p></div>
|
<div class="doc-comment"><p>Returns <code>this |> transform</code> if <code>this</code> is non-null, and <code>null</code> otherwise.</p></div>
|
||||||
<div class="doc-comment expandable hidden collapsed"><p>This method is the complement of the <code>??</code> operator and the equivalent of an <code>Option</code> type's
|
<div class="doc-comment expandable hidden collapsed"><p>This method is the complement of the <code>??</code> operator and the equivalent of an <code>Option</code> type's
|
||||||
<code>map</code> and <code>flatMap</code> methods.</p></div>
|
<code>map</code> and <code>flatMap</code> methods.</p></div>
|
||||||
|
|||||||
+2
-2
@@ -82,7 +82,7 @@
|
|||||||
<div class="member-modifiers">function </div>
|
<div class="member-modifiers">function </div>
|
||||||
</div>
|
</div>
|
||||||
<div class="member-main">
|
<div class="member-main">
|
||||||
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">getClass</span>(): <a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Class.html" class="name-ref">Class</a><span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">getClass</span>(): <a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Class.html" class="name-ref">Class</a><this><span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
||||||
<div class="doc-comment"><p>Returns the class of <code>this</code>.</p></div>
|
<div class="doc-comment"><p>Returns the class of <code>this</code>.</p></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -109,7 +109,7 @@
|
|||||||
<div class="member-modifiers">function </div>
|
<div class="member-modifiers">function </div>
|
||||||
</div>
|
</div>
|
||||||
<div class="member-main">
|
<div class="member-main">
|
||||||
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">ifNonNull</span><<a class="param1">Result</a>>(<span class="param2">transform</span>: (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html#NonNull" class="name-ref">NonNull</a>) -> <a href="MyClass3.html#ifNonNull().Result" class="name-ref">Result</a>): <a href="MyClass3.html#ifNonNull().Result" class="name-ref">Result</a>?<span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">ifNonNull</span><<a class="param1">Result</a>>(<span class="param2">transform</span>: (this) -> <a href="MyClass3.html#ifNonNull().Result" class="name-ref">Result</a>): <a href="MyClass3.html#ifNonNull().Result" class="name-ref">Result</a>?<span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
||||||
<div class="doc-comment"><p>Returns <code>this |> transform</code> if <code>this</code> is non-null, and <code>null</code> otherwise.</p></div>
|
<div class="doc-comment"><p>Returns <code>this |> transform</code> if <code>this</code> is non-null, and <code>null</code> otherwise.</p></div>
|
||||||
<div class="doc-comment expandable hidden collapsed"><p>This method is the complement of the <code>??</code> operator and the equivalent of an <code>Option</code> type's
|
<div class="doc-comment expandable hidden collapsed"><p>This method is the complement of the <code>??</code> operator and the equivalent of an <code>Option</code> type's
|
||||||
<code>map</code> and <code>flatMap</code> methods.</p></div>
|
<code>map</code> and <code>flatMap</code> methods.</p></div>
|
||||||
|
|||||||
+2
-2
@@ -93,7 +93,7 @@
|
|||||||
<div class="member-modifiers">function </div>
|
<div class="member-modifiers">function </div>
|
||||||
</div>
|
</div>
|
||||||
<div class="member-main">
|
<div class="member-main">
|
||||||
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">getClass</span>(): <a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Class.html" class="name-ref">Class</a><span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">getClass</span>(): <a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Class.html" class="name-ref">Class</a><this><span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
||||||
<div class="doc-comment"><p>Returns the class of <code>this</code>.</p></div>
|
<div class="doc-comment"><p>Returns the class of <code>this</code>.</p></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -120,7 +120,7 @@
|
|||||||
<div class="member-modifiers">function </div>
|
<div class="member-modifiers">function </div>
|
||||||
</div>
|
</div>
|
||||||
<div class="member-main">
|
<div class="member-main">
|
||||||
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">ifNonNull</span><<a class="param1">Result</a>>(<span class="param2">transform</span>: (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html#NonNull" class="name-ref">NonNull</a>) -> <a href="MyClass4.html#ifNonNull().Result" class="name-ref">Result</a>): <a href="MyClass4.html#ifNonNull().Result" class="name-ref">Result</a>?<span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
<div class="member-signature"><span class="context"><a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/Any.html" class="name-ref">Any</a>.</span><span class="name-decl">ifNonNull</span><<a class="param1">Result</a>>(<span class="param2">transform</span>: (this) -> <a href="MyClass4.html#ifNonNull().Result" class="name-ref">Result</a>): <a href="MyClass4.html#ifNonNull().Result" class="name-ref">Result</a>?<span class="context"> (<a href="https://pages.github.com/apple/pkl/stdlib/pkl/0.24.0/base/index.html" class="name-ref">pkl.base</a>)</span><a class="member-source-link" href="https://github.com/apple/pkl/blob/0.24.0/stdlib/base.pkl#L123-L456">Source</a></div>
|
||||||
<div class="doc-comment"><p>Returns <code>this |> transform</code> if <code>this</code> is non-null, and <code>null</code> otherwise.</p></div>
|
<div class="doc-comment"><p>Returns <code>this |> transform</code> if <code>this</code> is non-null, and <code>null</code> otherwise.</p></div>
|
||||||
<div class="doc-comment expandable hidden collapsed"><p>This method is the complement of the <code>??</code> operator and the equivalent of an <code>Option</code> type's
|
<div class="doc-comment expandable hidden collapsed"><p>This method is the complement of the <code>??</code> operator and the equivalent of an <code>Option</code> type's
|
||||||
<code>map</code> and <code>flatMap</code> methods.</p></div>
|
<code>map</code> and <code>flatMap</code> methods.</p></div>
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user