From 17175d3e2bde63a540d7584e6ac2b2b2f4ae68bc Mon Sep 17 00:00:00 2001 From: Dan Chao Date: Mon, 27 Jul 2026 21:59:56 -0700 Subject: [PATCH 1/3] Add `this` as a self type --- .../main/java/org/pkl/core/EvaluatorImpl.java | 9 +- .../src/main/java/org/pkl/core/PType.java | 11 + .../org/pkl/core/ast/builder/AstBuilder.java | 75 ++++- .../org/pkl/core/ast/builder/SymbolTable.java | 47 +++- .../ast/expression/member/ReadClassNode.java | 75 +++++ .../ast/expression/primary/GetModuleNode.java | 3 + .../primary/GetReceiverClassNode.java | 33 +++ .../core/ast/type/GetParentForTypeNode.java | 4 +- .../java/org/pkl/core/ast/type/TypeNode.java | 264 +++++++++++------- .../pkl/core/ast/type/UnresolvedTypeNode.java | 24 +- .../java/org/pkl/core/repl/ReplServer.java | 3 + .../pkl/core/runtime/CommandSpecParser.java | 2 + .../org/pkl/core/runtime/MirrorFactories.java | 3 + .../org/pkl/core/runtime/ModuleCache.java | 15 +- .../org/pkl/core/runtime/ReflectModule.java | 10 +- .../org/pkl/core/runtime/StdLibModule.java | 1 + .../java/org/pkl/core/runtime/VmLanguage.java | 6 +- .../org/pkl/core/runtime/VmReference.java | 60 ++-- .../org/pkl/core/runtime/VmTypeAlias.java | 1 + .../java/org/pkl/core/runtime/VmUtils.java | 6 +- .../pkl/core/stdlib/reflect/ReflectNodes.java | 8 + .../org/pkl/core/errorMessages.properties | 3 + .../input-helper/api/reflect/BaseModule.pkl | 2 + .../input-helper/types/aliasHolder.pkl | 1 + .../input-helper/types/moduleTypeProperty.pkl | 6 + .../input/api/reference.pkl | 14 +- .../input/api/reflect1.pkl | 2 + .../input/basic/reference.pkl | 2 +- .../input/errors/reference1.pkl | 2 +- .../input/errors/reference10.pkl | 2 +- .../input/errors/reference11.pkl | 2 +- .../input/errors/reference12.pkl | 2 +- .../input/errors/reference13.pkl | 2 +- .../input/errors/reference14.pkl | 2 +- .../input/errors/reference15.pkl | 2 +- .../input/errors/reference16.pkl | 2 +- .../input/errors/reference17.pkl | 2 +- .../input/errors/reference18.pkl | 2 +- .../input/errors/reference19.pkl | 2 +- .../input/errors/reference2.pkl | 2 +- .../input/errors/reference20.pkl | 4 +- .../input/errors/reference28.pkl | 45 +++ .../input/errors/reference29.pkl | 32 +++ .../input/errors/reference3.pkl | 2 +- .../input/errors/reference30.pkl | 30 ++ .../input/errors/reference4.pkl | 2 +- .../input/errors/reference5.pkl | 4 +- .../input/errors/reference6.pkl | 2 +- .../input/errors/reference7.pkl | 2 +- .../input/errors/reference8.pkl | 2 +- .../input/errors/reference9.pkl | 2 +- .../input/types/currentModuleType1.pkl | 22 +- .../input/types/currentModuleType2.pkl | 22 +- .../input/types/currentModuleType4.pkl | 5 + .../input/types/currentModuleType5.pkl | 7 + .../input/types/currentModuleType6.pkl | 21 ++ .../input/types/currentModuleType7.pkl | 19 ++ .../input/types/thisType1.pkl | 120 ++++++++ .../input/types/thisType2.pkl | 1 + .../input/types/thisType3.pkl | 21 ++ .../input/types/thisType4.pkl | 22 ++ .../input/types/thisType5.pkl | 16 ++ .../output/api/reference.pcf | 1 + .../output/api/reflect1.pcf | 4 +- .../output/errors/reference20.err | 4 +- .../output/errors/reference28.pcf | 12 + .../output/errors/reference29.pcf | 6 + .../output/errors/reference30.pcf | 6 + .../output/types/currentModuleType1.err | 5 + .../output/types/currentModuleType1.pcf | 1 - .../output/types/currentModuleType2.err | 5 + .../output/types/currentModuleType2.pcf | 1 - .../output/types/currentModuleType3.err | 5 + .../output/types/currentModuleType3.pcf | 1 - .../output/types/currentModuleType4.err | 2 + .../output/types/currentModuleType5.pcf | 2 + .../output/types/currentModuleType6.err | 19 ++ .../output/types/currentModuleType7.pcf | 1 + .../output/types/thisType1.pcf | 11 + .../output/types/thisType2.err | 6 + .../output/types/thisType3.pcf | 15 + .../output/types/thisType4.pcf | 15 + .../output/types/thisType5.pcf | 13 + .../org/pkl/doc/PackageDataGenerator.kt | 5 +- .../main/kotlin/org/pkl/doc/PageGenerator.kt | 3 + .../org/pkl/doc/SearchIndexGenerator.kt | 3 + .../main/java/org/pkl/formatter/Builder.java | 1 + .../org/pkl/parser/BaseParserVisitor.java | 6 + .../org/pkl/parser/GenericParserImpl.java | 1 + .../main/java/org/pkl/parser/ParserImpl.java | 1 + .../java/org/pkl/parser/ParserVisitor.java | 4 +- .../main/java/org/pkl/parser/syntax/Type.java | 11 + .../pkl/parser/syntax/generic/NodeType.java | 1 + .../kotlin/org/pkl/parser/SexpRenderer.kt | 4 + stdlib/base.pkl | 4 +- stdlib/ref.pkl | 2 +- stdlib/reflect.pkl | 8 + 97 files changed, 1097 insertions(+), 209 deletions(-) create mode 100644 pkl-core/src/main/java/org/pkl/core/ast/expression/member/ReadClassNode.java create mode 100644 pkl-core/src/main/java/org/pkl/core/ast/expression/primary/GetReceiverClassNode.java create mode 100644 pkl-core/src/test/files/LanguageSnippetTests/input-helper/types/aliasHolder.pkl create mode 100644 pkl-core/src/test/files/LanguageSnippetTests/input-helper/types/moduleTypeProperty.pkl create mode 100644 pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference28.pkl create mode 100644 pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference29.pkl create mode 100644 pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference30.pkl create mode 100644 pkl-core/src/test/files/LanguageSnippetTests/input/types/currentModuleType4.pkl create mode 100644 pkl-core/src/test/files/LanguageSnippetTests/input/types/currentModuleType5.pkl create mode 100644 pkl-core/src/test/files/LanguageSnippetTests/input/types/currentModuleType6.pkl create mode 100644 pkl-core/src/test/files/LanguageSnippetTests/input/types/currentModuleType7.pkl create mode 100644 pkl-core/src/test/files/LanguageSnippetTests/input/types/thisType1.pkl create mode 100644 pkl-core/src/test/files/LanguageSnippetTests/input/types/thisType2.pkl create mode 100644 pkl-core/src/test/files/LanguageSnippetTests/input/types/thisType3.pkl create mode 100644 pkl-core/src/test/files/LanguageSnippetTests/input/types/thisType4.pkl create mode 100644 pkl-core/src/test/files/LanguageSnippetTests/input/types/thisType5.pkl create mode 100644 pkl-core/src/test/files/LanguageSnippetTests/output/errors/reference28.pcf create mode 100644 pkl-core/src/test/files/LanguageSnippetTests/output/errors/reference29.pcf create mode 100644 pkl-core/src/test/files/LanguageSnippetTests/output/errors/reference30.pcf create mode 100644 pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType1.err delete mode 100644 pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType1.pcf create mode 100644 pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType2.err delete mode 100644 pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType2.pcf create mode 100644 pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType3.err delete mode 100644 pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType3.pcf create mode 100644 pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType4.err create mode 100644 pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType5.pcf create mode 100644 pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType6.err create mode 100644 pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType7.pcf create mode 100644 pkl-core/src/test/files/LanguageSnippetTests/output/types/thisType1.pcf create mode 100644 pkl-core/src/test/files/LanguageSnippetTests/output/types/thisType2.err create mode 100644 pkl-core/src/test/files/LanguageSnippetTests/output/types/thisType3.pcf create mode 100644 pkl-core/src/test/files/LanguageSnippetTests/output/types/thisType4.pcf create mode 100644 pkl-core/src/test/files/LanguageSnippetTests/output/types/thisType5.pcf diff --git a/pkl-core/src/main/java/org/pkl/core/EvaluatorImpl.java b/pkl-core/src/main/java/org/pkl/core/EvaluatorImpl.java index 7113d4c6f..a45c1271c 100644 --- a/pkl-core/src/main/java/org/pkl/core/EvaluatorImpl.java +++ b/pkl-core/src/main/java/org/pkl/core/EvaluatorImpl.java @@ -212,7 +212,8 @@ public Object evaluateExpression(ModuleSource moduleSource, String expression) { moduleSource, (module) -> { var expressionResult = - VmUtils.evaluateExpression(module, expression, securityManager, moduleResolver); + VmUtils.evaluateExpression( + module, expression, securityManager, moduleResolver, logger); if (expressionResult instanceof VmValue value) { value.force(false); return value.export(); @@ -243,7 +244,8 @@ public byte[] evaluateExpressionPklBinary(ModuleSource moduleSource, String expr VmUtils.readMember(VmUtils.readModuleOutput(module), Identifier.VALUE); case "output.bytes" -> VmUtils.readBytesProperty(VmUtils.readModuleOutput(module)); default -> - VmUtils.evaluateExpression(module, expression, securityManager, moduleResolver); + VmUtils.evaluateExpression( + module, expression, securityManager, moduleResolver, logger); }; VmValue.force(expressionResult, false); @@ -264,7 +266,8 @@ public String evaluateExpressionString(ModuleSource moduleSource, String express moduleSource, (module) -> { var expressionResult = - VmUtils.evaluateExpression(module, expression, securityManager, moduleResolver); + VmUtils.evaluateExpression( + module, expression, securityManager, moduleResolver, logger); var toStringNode = ToStringNodeGen.create( VmUtils.unavailableSourceSection(), new ConstantValueNode(expressionResult)); diff --git a/pkl-core/src/main/java/org/pkl/core/PType.java b/pkl-core/src/main/java/org/pkl/core/PType.java index 8312de05d..3bd073bd5 100644 --- a/pkl-core/src/main/java/org/pkl/core/PType.java +++ b/pkl-core/src/main/java/org/pkl/core/PType.java @@ -57,6 +57,17 @@ public String toString() { } }; + /** 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() {} public List getTypeArguments() { diff --git a/pkl-core/src/main/java/org/pkl/core/ast/builder/AstBuilder.java b/pkl-core/src/main/java/org/pkl/core/ast/builder/AstBuilder.java index 22836aaa9..b444320a2 100644 --- a/pkl-core/src/main/java/org/pkl/core/ast/builder/AstBuilder.java +++ b/pkl-core/src/main/java/org/pkl/core/ast/builder/AstBuilder.java @@ -35,6 +35,7 @@ import java.util.stream.Collectors; import org.graalvm.collections.EconomicMap; import org.jspecify.annotations.Nullable; +import org.pkl.core.Logger; import org.pkl.core.PClassInfo; import org.pkl.core.PklBugException; import org.pkl.core.SecurityManagerException; @@ -121,6 +122,7 @@ import org.pkl.core.ast.expression.member.InvokeSuperMethodNodeGen; import org.pkl.core.ast.expression.member.ReadAmbiguousLocalityPropertyNode; import org.pkl.core.ast.expression.member.ReadLexicalLocalPropertyNode; +import org.pkl.core.ast.expression.member.ReadClassNode; import org.pkl.core.ast.expression.member.ReadPropertyNodeGen; import org.pkl.core.ast.expression.member.ReadQualifiedLocalPropertyNode; import org.pkl.core.ast.expression.member.ReadSuperEntryNode; @@ -130,6 +132,7 @@ import org.pkl.core.ast.expression.primary.GetMemberKeyNode; import org.pkl.core.ast.expression.primary.GetModuleNode; 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.GetTypeAliasModuleNode; import org.pkl.core.ast.expression.primary.OuterNode; @@ -207,6 +210,7 @@ import org.pkl.core.stdlib.registry.MemberRegistryFactory; import org.pkl.core.util.CollectionUtils; import org.pkl.core.util.EconomicMaps; +import org.pkl.core.util.ErrorMessages; import org.pkl.core.util.IoUtils; import org.pkl.core.util.Pair; import org.pkl.parser.Span; @@ -278,6 +282,7 @@ import org.pkl.parser.syntax.Type.NullableType; import org.pkl.parser.syntax.Type.ParenthesizedType; 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.UnknownType; import org.pkl.parser.syntax.TypeAlias; @@ -286,6 +291,7 @@ public class AstBuilder extends AbstractAstBuilder { private final VmLanguage language; + private final Logger logger; private final ModuleInfo moduleInfo; private final ModuleKey moduleKey; @@ -297,9 +303,14 @@ public class AstBuilder extends AbstractAstBuilder { private final boolean isMethodReturnTypeChecked; public AstBuilder( - Source source, VmLanguage language, ModuleInfo moduleInfo, ModuleResolver moduleResolver) { + Source source, + VmLanguage language, + Logger logger, + ModuleInfo moduleInfo, + ModuleResolver moduleResolver) { super(source); this.language = language; + this.logger = logger; this.moduleInfo = moduleInfo; moduleKey = moduleInfo.getModuleKey(); @@ -314,6 +325,7 @@ public AstBuilder( public static AstBuilder create( Source source, VmLanguage language, + Logger logger, Module ctx, ModuleKey moduleKey, ResolvedModuleKey resolvedModuleKey, @@ -354,7 +366,7 @@ public static AstBuilder create( isAmend); } - return new AstBuilder(source, language, moduleInfo, moduleResolver); + return new AstBuilder(source, language, logger, moduleInfo, moduleResolver); } @Override @@ -369,7 +381,59 @@ public UnresolvedTypeNode visitNothingType(NothingType type) { @Override public UnresolvedTypeNode visitModuleType(ModuleType type) { - return new UnresolvedTypeNode.Module(createSourceSection(type)); + var sourceSection = createSourceSection(type); + for (var scope = symbolTable.getCurrentScope(); scope != null; scope = scope.getParent()) { + if (scope.isAnnotationScope()) break; + if (scope instanceof ClassScope classScope && classScope.getSuperClass() != type) { + logger.warn( + ErrorMessages.create("invalidSelfTypeUsage", "module", "class") + + " This will be an error in a future release.", + VmUtils.createStackFrame(sourceSection, null)); + break; + } else if (scope.isTypeAliasScope()) { + logger.warn( + ErrorMessages.create("invalidSelfTypeUsage", "module", "type alias") + + " This will be an error in a future release.", + VmUtils.createStackFrame(sourceSection, null)); + break; + } + } + + return new UnresolvedTypeNode.Module(sourceSection); + } + + @Override + public UnresolvedTypeNode visitThisType(ThisType type) { + var sourceSection = createSourceSection(type); + // need to pass explicit class name for property and method arg/return type annotations + // do not need: when in any object or at the module level (where `this` is the receiver's class) + ClassScope classScope = null; + var baseScope = symbolTable.getCurrentScope(); + for (var scope = baseScope; scope != null; scope = scope.getParent()) { + if (scope.isObjectScope() || scope.isCustomThisScope()) { + break; + } + if (scope instanceof ClassScope foundClassScope) { + classScope = foundClassScope; + 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("invalidSelfTypeUsage", "this", "type alias") + .build(); + } + } + + var getClassNode = + classScope == null + ? new GetReceiverClassNode(sourceSection) + : isBaseModule + ? new GetBaseModuleClassNode(classScope.getName()) + : new ReadClassNode(sourceSection, classScope.getName(), classScope.isLocal()); + return new UnresolvedTypeNode.This(sourceSection, getClassNode); } @Override @@ -796,6 +860,7 @@ private ExpressionNode resolvedMethodCall(UnqualifiedAccessExpr expr, ArgumentLi // Assumption: typealiases can only be declared on the module. // If we ever allow typealiases in classes, this code needs to change. if (symbolTable.isInTypeAliasScope && method.isModuleScope()) { + if (scope.isInTypeAliasScope() && method.isModuleScope()) { var getModuleNode = new GetTypeAliasModuleNode(sourceSection); if (method.isObjectMethod()) { return new InvokeQualifiedObjectMethodNode( @@ -1758,11 +1823,13 @@ public ObjectMember visitClass(Class clazz) { org.pkl.core.runtime.Identifier.property(clazz.getName().getValue(), isLocalClass); var annotations = doVisitAnnotations(clazz.getAnnotations(), className); + var supertypeCtx = clazz.getSuperClass(); return symbolTable.enterClass( className, modifiers, typeParameters, + supertypeCtx, scope -> { var bodyNode = clazz.getBody(); @@ -1771,8 +1838,6 @@ public ObjectMember visitClass(Class clazz) { registerClassScopeNames(scope, properties, methods); checkAbstractMethodsAllowed(modifiers, methods, "class"); - var supertypeCtx = clazz.getSuperClass(); - // needs to be inside `enterClass` so that class' type parameters are in scope var supertypeNode = supertypeCtx != null diff --git a/pkl-core/src/main/java/org/pkl/core/ast/builder/SymbolTable.java b/pkl-core/src/main/java/org/pkl/core/ast/builder/SymbolTable.java index c502469d1..5f0c4e066 100644 --- a/pkl-core/src/main/java/org/pkl/core/ast/builder/SymbolTable.java +++ b/pkl-core/src/main/java/org/pkl/core/ast/builder/SymbolTable.java @@ -43,6 +43,7 @@ import org.pkl.core.util.ArrayUtils; import org.pkl.core.util.LateInit; import org.pkl.parser.Lexer; +import org.pkl.parser.syntax.Type; public final class SymbolTable { @@ -71,6 +72,7 @@ public ObjectMember enterClass( Identifier name, int modifiers, List typeParameters, + @Nullable Type superClass, Function nodeFactory) { return doEnter( new ClassScope( @@ -79,7 +81,8 @@ public ObjectMember enterClass( toQualifiedName(name), modifiers, new FrameDescriptorBuilder(), - typeParameters), + typeParameters, + superClass), nodeFactory); } @@ -410,6 +413,10 @@ public final Scope skipLambdaAndLetScopes() { return curr; } + public final boolean isAnnotationScope() { + return this instanceof AnnotationScope; + } + public final boolean isLetScope() { return this instanceof LetExpressionScope; } @@ -422,6 +429,14 @@ public final boolean isClassScope() { return this instanceof ClassScope; } + public final boolean isTypeAliasScope() { + return this instanceof TypeAliasScope; + } + + public final boolean isObjectScope() { + return this instanceof ObjectScope; + } + public final boolean isClassMemberScope() { var effectiveScope = skipLambdaAndLetScopes(); var parent = effectiveScope.parent; @@ -454,6 +469,19 @@ public final boolean isForGeneratorScope() { return this instanceof ForGeneratorScope; } + public final boolean isTypeAliasScope() { + return this instanceof TypeAliasScope; + } + + public final boolean isInTypeAliasScope() { + for (var scope = this; scope != null; scope = scope.getParent()) { + if (scope.isTypeAliasScope()) { + return true; + } + } + return false; + } + public ConstLevel getConstLevel() { return constLevel; } @@ -988,6 +1016,8 @@ public EntryOrElementScope( public static final class ClassScope extends TypeParameterizableScope implements LexicalScope { private final boolean isClosed; + private final boolean isLocal; + private final @Nullable Type superClass; public ClassScope( Scope parent, @@ -995,7 +1025,8 @@ public ClassScope( String qualifiedName, int modifiers, FrameDescriptorBuilder frameDescriptorBuilder, - List typeParameters) { + List typeParameters, + @Nullable Type superClass) { super( parent, name, @@ -1006,11 +1037,12 @@ public ClassScope( EMPTY_INT_ARRAY, EMPTY_INT_ARRAY); isClosed = VmModifier.isClosed(modifiers); + isLocal = VmModifier.isLocal(modifiers); + this.superClass = superClass; } @Override public @Nullable VariableResolution doResolveProperty(String name, int levelsUp) { - var member = properties.get(name); if (member == null) return null; return new LexicalProperty(false, member.modifiers, levelsUp); @@ -1018,11 +1050,18 @@ public ClassScope( @Override public @Nullable MethodResolution doResolveMethod(String name, int levelsUp) { - var member = methods.get(name); if (member == null) return null; return new LexicalMethod(false, isClosed, false, member.modifiers, levelsUp); } + + public boolean isLocal() { + return isLocal; + } + + public @Nullable Type getSuperClass() { + return superClass; + } } public static final class TypeAliasScope extends TypeParameterizableScope { diff --git a/pkl-core/src/main/java/org/pkl/core/ast/expression/member/ReadClassNode.java b/pkl-core/src/main/java/org/pkl/core/ast/expression/member/ReadClassNode.java new file mode 100644 index 000000000..28746e7cd --- /dev/null +++ b/pkl-core/src/main/java/org/pkl/core/ast/expression/member/ReadClassNode.java @@ -0,0 +1,75 @@ +/* + * 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.member; + +import com.oracle.truffle.api.CompilerDirectives; +import com.oracle.truffle.api.frame.VirtualFrame; +import com.oracle.truffle.api.nodes.DirectCallNode; +import com.oracle.truffle.api.source.SourceSection; +import org.jspecify.annotations.Nullable; +import org.pkl.core.ast.ExpressionNode; +import org.pkl.core.ast.expression.primary.GetModuleNode; +import org.pkl.core.ast.member.ObjectMember; +import org.pkl.core.runtime.Identifier; +import org.pkl.core.runtime.VmTyped; + +/** Read a class by name from the current receiver's module */ +public final class ReadClassNode extends ExpressionNode { + + private final Identifier className; + private final boolean isLocal; + private @Child ExpressionNode getModuleNode; + @Child private @Nullable DirectCallNode callNode; + + public ReadClassNode(SourceSection sourceSection, Identifier className, boolean isLocal) { + super(sourceSection); + this.getModuleNode = new GetModuleNode(sourceSection); + this.className = className; + this.isLocal = isLocal; + } + + public Object executeGeneric(VirtualFrame frame) { + var module = (VmTyped) getModuleNode.executeGeneric(frame); + + if (!isLocal) { + var clazz = module.getCachedValue(className); + if (clazz != null) return clazz; + } + + var member = module.getMember(className); + assert member != null; + assert member.isClass(); + + if (isLocal) { + var clazz = module.getCachedValue(member); + if (clazz != null) return clazz; + } + + var clazz = getCallNode(member).call(module, module, member.getName()); + module.setCachedValue(isLocal ? member : className, clazz); + return clazz; + } + + private DirectCallNode getCallNode(ObjectMember member) { + if (callNode == null) { + CompilerDirectives.transferToInterpreterAndInvalidate(); + callNode = DirectCallNode.create(member.getCallTarget()); + insert(callNode); + } + assert callNode != null; + return callNode; + } +} diff --git a/pkl-core/src/main/java/org/pkl/core/ast/expression/primary/GetModuleNode.java b/pkl-core/src/main/java/org/pkl/core/ast/expression/primary/GetModuleNode.java index dd40605d8..ea1abb8fc 100644 --- a/pkl-core/src/main/java/org/pkl/core/ast/expression/primary/GetModuleNode.java +++ b/pkl-core/src/main/java/org/pkl/core/ast/expression/primary/GetModuleNode.java @@ -25,6 +25,9 @@ @NodeInfo(shortName = "module") 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) { super(sourceSection); } diff --git a/pkl-core/src/main/java/org/pkl/core/ast/expression/primary/GetReceiverClassNode.java b/pkl-core/src/main/java/org/pkl/core/ast/expression/primary/GetReceiverClassNode.java new file mode 100644 index 000000000..b5ea3b592 --- /dev/null +++ b/pkl-core/src/main/java/org/pkl/core/ast/expression/primary/GetReceiverClassNode.java @@ -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)); + } +} diff --git a/pkl-core/src/main/java/org/pkl/core/ast/type/GetParentForTypeNode.java b/pkl-core/src/main/java/org/pkl/core/ast/type/GetParentForTypeNode.java index 20021a4ab..59e9567a5 100644 --- a/pkl-core/src/main/java/org/pkl/core/ast/type/GetParentForTypeNode.java +++ b/pkl-core/src/main/java/org/pkl/core/ast/type/GetParentForTypeNode.java @@ -58,8 +58,8 @@ public Object executeGeneric(VirtualFrame frame) { var defaultValue = 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 - // (the default value changes when inherited). + // can't cache default value for `module`/`this` types in a non-final modules/classes because + // they're self types (the default value changes when inherited). if (typeNode.isFinalType() && defaultValue != null) { unresolvedTypeNode = null; this.defaultValue = defaultValue; diff --git a/pkl-core/src/main/java/org/pkl/core/ast/type/TypeNode.java b/pkl-core/src/main/java/org/pkl/core/ast/type/TypeNode.java index 933188582..0efec332a 100644 --- a/pkl-core/src/main/java/org/pkl/core/ast/type/TypeNode.java +++ b/pkl-core/src/main/java/org/pkl/core/ast/type/TypeNode.java @@ -45,6 +45,7 @@ import org.pkl.core.ast.*; import org.pkl.core.ast.builder.SymbolTable.CustomThisScope; import org.pkl.core.ast.expression.primary.GetModuleNode; +import org.pkl.core.ast.expression.primary.GetReceiverNode; import org.pkl.core.ast.frame.WriteFrameSlotNode; import org.pkl.core.ast.frame.WriteFrameSlotNodeGen; import org.pkl.core.ast.internal.SyntheticNode; @@ -53,6 +54,7 @@ import org.pkl.core.ast.member.ObjectMember; import org.pkl.core.ast.member.UntypedObjectMemberNode; import org.pkl.core.runtime.*; +import org.pkl.core.stdlib.VmObjectFactory; import org.pkl.core.util.EconomicMaps; import org.pkl.core.util.EconomicSets; import org.pkl.core.util.LateInit; @@ -142,7 +144,7 @@ public final boolean isFinalType() { true, typeNode -> { // assumption: don't need to worry about `NonFinalClassTypeNode` - if (typeNode instanceof NonFinalModuleTypeNode) { + if (typeNode instanceof NonFinalSelfTypeNode) { ret.set(false); return false; } @@ -169,7 +171,7 @@ public static TypeNode forClass(SourceSection sourceSection, VmClass clazz) { } public static PType export(@Nullable TypeNode node) { - return node != null ? node.doExport() : PType.UNKNOWN; + return node != null ? node.doExport(null) : PType.UNKNOWN; } public static VmTyped getMirror(@Nullable TypeNode node) { @@ -184,7 +186,11 @@ public static VmList getMirrors(TypeNode[] nodes) { return builder.build(); } - protected PType doExport() { + /** + * If {@code frame} is provided then self types should be resolved to real types, otherwise return + * the self PType + */ + protected PType doExport(@Nullable VirtualFrame frame) { var alias = getVmTypeAlias(); // needs to come before `clazz != null` check if (alias != null) { @@ -347,7 +353,7 @@ public VmTyped getMirror() { } @Override - protected PType doExport() { + protected PType doExport(@Nullable VirtualFrame frame) { return PType.UNKNOWN; } @@ -399,7 +405,7 @@ public boolean doIsEquivalentTo(TypeNode other) { } @Override - protected PType doExport() { + protected PType doExport(@Nullable VirtualFrame frame) { return PType.NOTHING; } @@ -409,44 +415,61 @@ protected boolean acceptTypeNode(boolean visitTypeArguments, TypeNodeConsumer co } } - /** The `module` type for a final module. */ - public static final class FinalModuleTypeNode extends ObjectSlotTypeNode - implements ClassTypeNode { - private final VmClass moduleClass; + /** The `module` or `this` type for a final module or class. */ + public static final class FinalSelfTypeNode extends ObjectSlotTypeNode implements ClassTypeNode { + private final VmClass clazz; + private final PType pType; + private final VmObjectFactory mirrorFactory; - public FinalModuleTypeNode(SourceSection sourceSection, VmClass moduleClass) { + private FinalSelfTypeNode( + SourceSection sourceSection, + VmClass clazz, + PType pType, + VmObjectFactory mirrorFactory) { 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 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 public VmTyped getMirror() { - return MirrorFactories.moduleTypeFactory.create(null); + return mirrorFactory.create(null); } @Override public boolean doIsEquivalentTo(TypeNode other) { - if (!(other instanceof FinalModuleTypeNode finalModuleTypeNode)) { + if (!(other instanceof FinalSelfTypeNode finalModuleTypeNode)) { return false; } - return moduleClass.equals(finalModuleTypeNode.moduleClass); + return clazz.equals(finalModuleTypeNode.clazz); } @Override - protected PType doExport() { - return PType.MODULE; + protected PType doExport(@Nullable VirtualFrame frame) { + return frame == null ? pType : new PType.Class(clazz.export()); } @Override public VmClass getVmClass() { - return moduleClass; + return clazz; } @Override @@ -460,55 +483,81 @@ protected boolean acceptTypeNode(boolean visitTypeArguments, TypeNodeConsumer co VmLanguage language, SourceSection headerSection, String qualifiedName) { - return TypeNode.createDefaultValue(moduleClass); + return TypeNode.createDefaultValue(clazz); } } - /** The `module` type for an open module. */ - public static final class NonFinalModuleTypeNode extends ObjectSlotTypeNode + /** The `module` or `this` type for an open module or class. */ + public static final class NonFinalSelfTypeNode extends ObjectSlotTypeNode implements ClassTypeNode { - private final VmClass moduleClass; // only used by getVmClass() - @Child private ExpressionNode getModuleNode; + private final VmClass clazz; // only used by getVmClass() + @Child private ExpressionNode getTargetNode; + private final PType pType; + private final VmObjectFactory mirrorFactory; + @CompilationFinal private int realFrameSlot = -1; - public NonFinalModuleTypeNode(SourceSection sourceSection, VmClass moduleClass) { + private NonFinalSelfTypeNode( + SourceSection sourceSection, + VmClass clazz, + ExpressionNode getTargetNode, + PType pType, + VmObjectFactory mirrorFactory) { super(sourceSection); - this.moduleClass = moduleClass; - getModuleNode = new GetModuleNode(sourceSection); + this.clazz = clazz; + 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 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) { 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 public VmTyped getMirror() { - return MirrorFactories.moduleTypeFactory.create(null); + return mirrorFactory.create(null); } @Override public boolean doIsEquivalentTo(TypeNode other) { - if (!(other instanceof NonFinalModuleTypeNode nonFinalModuleTypeNode)) { + if (!(other instanceof NonFinalSelfTypeNode nonFinalModuleTypeNode)) { return false; } - return moduleClass.equals(nonFinalModuleTypeNode.moduleClass); + return clazz.equals(nonFinalModuleTypeNode.clazz); } @Override - protected PType doExport() { - return PType.MODULE; + protected PType doExport(@Nullable VirtualFrame frame) { + if (frame == null) return pType; + var clazz = ((VmObjectLike) getTargetNode.executeGeneric(frame)).getVmClass(); + return new PType.Class(clazz.export()); } @Override public VmClass getVmClass() { - return moduleClass; + return clazz; } @Override @@ -522,8 +571,8 @@ protected boolean acceptTypeNode(boolean visitTypeArguments, TypeNodeConsumer co VmLanguage language, SourceSection headerSection, String qualifiedName) { - var moduleClass = ((VmTyped) getModuleNode.executeGeneric(frame)).getVmClass(); - return TypeNode.createDefaultValue(moduleClass); + var clazz = ((VmObjectLike) getTargetNode.executeGeneric(frame)).getVmClass(); + return TypeNode.createDefaultValue(clazz); } } @@ -570,7 +619,7 @@ public VmTyped getMirror() { } @Override - protected PType doExport() { + protected PType doExport(@Nullable VirtualFrame frame) { return new PType.StringLiteral(literal); } @@ -810,8 +859,8 @@ public VmTyped getElementTypeMirror() { } @Override - protected final PType doExport() { - return new PType.Nullable(elementTypeNode.doExport()); + protected final PType doExport(@Nullable VirtualFrame frame) { + return new PType.Nullable(elementTypeNode.doExport(frame)); } @Override @@ -893,9 +942,11 @@ public boolean isNoopTypeCheck() { } @Override - protected PType doExport() { + protected PType doExport(@Nullable VirtualFrame frame) { var elementTypes = - Arrays.stream(elementTypeNodes).map(TypeNode::export).collect(Collectors.toList()); + Arrays.stream(elementTypeNodes) + .map(it -> it.doExport(frame)) + .collect(Collectors.toList()); return new PType.Union(elementTypes); } @@ -1113,7 +1164,7 @@ private boolean contains(Object value) { } @Override - protected PType doExport() { + protected PType doExport(@Nullable VirtualFrame frame) { return new PType.Union( stringLiterals.stream().map(StringLiteral::new).collect(Collectors.toList())); } @@ -1198,8 +1249,9 @@ public VmClass getVmClass() { } @Override - protected PType doExport() { - return new PType.Class(BaseModule.getCollectionClass().export(), elementTypeNode.doExport()); + protected PType doExport(@Nullable VirtualFrame frame) { + return new PType.Class( + BaseModule.getCollectionClass().export(), elementTypeNode.doExport(frame)); } @Override @@ -1303,8 +1355,8 @@ public VmList getTypeArgumentMirrors() { } @Override - protected PType doExport() { - return new PType.Class(BaseModule.getListClass().export(), elementTypeNode.doExport()); + protected PType doExport(@Nullable VirtualFrame frame) { + return new PType.Class(BaseModule.getListClass().export(), elementTypeNode.doExport(frame)); } @Override @@ -1400,8 +1452,8 @@ public boolean doIsEquivalentTo(TypeNode other) { } @Override - protected final PType doExport() { - return new PType.Class(BaseModule.getSetClass().export(), elementTypeNode.doExport()); + protected final PType doExport(@Nullable VirtualFrame frame) { + return new PType.Class(BaseModule.getSetClass().export(), elementTypeNode.doExport(frame)); } @Override @@ -1500,9 +1552,11 @@ public boolean doIsEquivalentTo(TypeNode other) { } @Override - protected PType doExport() { + protected PType doExport(@Nullable VirtualFrame frame) { return new PType.Class( - BaseModule.getMapClass().export(), keyTypeNode.doExport(), valueTypeNode.doExport()); + BaseModule.getMapClass().export(), + keyTypeNode.doExport(frame), + valueTypeNode.doExport(frame)); } @Override @@ -1593,8 +1647,8 @@ public VmList getTypeArgumentMirrors() { } @Override - protected PType doExport() { - return new PType.Class(BaseModule.getListingClass().export(), valueTypeNode.doExport()); + protected PType doExport(@Nullable VirtualFrame frame) { + return new PType.Class(BaseModule.getListingClass().export(), valueTypeNode.doExport(frame)); } @Override @@ -1664,10 +1718,12 @@ public VmList getTypeArgumentMirrors() { } @Override - protected PType doExport() { + protected PType doExport(@Nullable VirtualFrame frame) { assert keyTypeNode != null; return new PType.Class( - BaseModule.getMappingClass().export(), keyTypeNode.doExport(), valueTypeNode.doExport()); + BaseModule.getMappingClass().export(), + keyTypeNode.doExport(frame), + valueTypeNode.doExport(frame)); } @Override @@ -1950,10 +2006,12 @@ public boolean doIsEquivalentTo(TypeNode other) { } @Override - protected final PType doExport() { + protected final PType doExport(@Nullable VirtualFrame frame) { var parameterTypes = - Arrays.stream(parameterTypeNodes).map(TypeNode::export).collect(Collectors.toList()); - return new PType.Function(parameterTypes, TypeNode.export(returnTypeNode)); + Arrays.stream(parameterTypeNodes) + .map(it -> it.doExport(frame)) + .collect(Collectors.toList()); + return new PType.Function(parameterTypes, returnTypeNode.doExport(frame)); } @Override @@ -2003,9 +2061,9 @@ public final VmList getTypeArgumentMirrors() { } @Override - protected final PType doExport() { + protected final PType doExport(@Nullable VirtualFrame frame) { return new PType.Class( - BaseModule.getFunctionClass().export(), TypeNode.export(typeArgumentNode)); + BaseModule.getFunctionClass().export(), typeArgumentNode.doExport(frame)); } @Specialization @@ -2082,9 +2140,11 @@ public boolean doIsEquivalentTo(TypeNode other) { } @Override - protected final PType doExport() { + protected final PType doExport(@Nullable VirtualFrame frame) { var typeArguments = - Arrays.stream(typeArgumentNodes).map(TypeNode::export).collect(Collectors.toList()); + Arrays.stream(typeArgumentNodes) + .map(it -> it.doExport(frame)) + .collect(Collectors.toList()); return new PType.Class(getFunctionNClass().export(), typeArguments); } @@ -2118,14 +2178,12 @@ protected boolean isParametric() { public abstract static class ReferenceTypeNode extends ValidatingObjectSlotTypeNode { @Child private TypeNode domainTypeNode; @Child private TypeNode referentTypeNode; - @Child private ExpressionNode getModuleNode; public ReferenceTypeNode( SourceSection sourceSection, TypeNode domainTypeNode, TypeNode referentTypeNode) { super(sourceSection); this.domainTypeNode = domainTypeNode; this.referentTypeNode = referentTypeNode; - this.getModuleNode = new GetModuleNode(sourceSection); validate(); } @@ -2162,30 +2220,21 @@ protected Object eval(VirtualFrame frame, VmReference value) { return value; } + var referentType = referentTypeNode.doExport(frame); + var domainType = domainTypeNode.doExport(frame); try { domainTypeNode.execute(frame, value.getDomain()); } catch (VmTypeMismatchException e) { CompilerDirectives.transferToInterpreter(); - throw new VmTypeMismatchException.Reference( - sourceSection, - value, - TypeNode.export(domainTypeNode), - TypeNode.export(referentTypeNode)); + throw new VmTypeMismatchException.Reference(sourceSection, value, domainType, referentType); } - var module = (VmTyped) getModuleNode.executeGeneric(frame); - return doEval(value, module); - } - - @TruffleBoundary - private Object doEval(VmReference value, VmTyped module) { - var referentType = TypeNode.export(referentTypeNode); - if (value.referentTypeIsSubtypeOf(referentType, module.getVmClass().export())) { + if (value.referentTypeIsSubtypeOf(referentType)) { return value; } - throw new VmTypeMismatchException.Reference( - sourceSection, value, TypeNode.export(domainTypeNode), referentType); + CompilerDirectives.transferToInterpreter(); + throw new VmTypeMismatchException.Reference(sourceSection, value, domainType, referentType); } @Fallback @@ -2226,11 +2275,11 @@ public boolean isNoopTypeCheck() { } @Override - protected PType doExport() { + protected PType doExport(@Nullable VirtualFrame frame) { return new PType.Class( RefModule.getReferenceClass().export(), - domainTypeNode.doExport(), - referentTypeNode.doExport()); + domainTypeNode.doExport(frame), + referentTypeNode.doExport(frame)); } @Override @@ -2293,9 +2342,11 @@ public boolean doIsEquivalentTo(TypeNode other) { } @Override - protected PType doExport() { + protected PType doExport(@Nullable VirtualFrame frame) { return new PType.Class( - BaseModule.getPairClass().export(), firstTypeNode.doExport(), secondTypeNode.doExport()); + BaseModule.getPairClass().export(), + firstTypeNode.doExport(frame), + secondTypeNode.doExport(frame)); } @Override @@ -2346,8 +2397,9 @@ public VarArgsTypeNode(SourceSection sourceSection, TypeNode elementTypeNode) { } @Override - protected final PType doExport() { - return new PType.Class(BaseModule.getVarArgsClass().export(), elementTypeNode.doExport()); + protected final PType doExport(@Nullable VirtualFrame frame) { + return new PType.Class( + BaseModule.getVarArgsClass().export(), elementTypeNode.doExport(frame)); } @Override @@ -2414,7 +2466,7 @@ public boolean doIsEquivalentTo(TypeNode other) { } @Override - protected PType doExport() { + protected PType doExport(@Nullable VirtualFrame frame) { return new PType.TypeVariable(typeParameter); } @@ -2738,6 +2790,7 @@ protected Object executeLazily(VirtualFrame frame, Object value) { return aliasedTypeNode.executeLazily(frame, value); } + /** See docstring on {@link TypeAliasTypeNode#executeLazily}. */ @Override public Object executeEagerly(VirtualFrame frame, Object value) { return aliasedTypeNode.executeEagerly(frame, value); @@ -2804,11 +2857,13 @@ public boolean doIsEquivalentTo(TypeNode other) { } @Override - protected PType doExport() { + protected PType doExport(@Nullable VirtualFrame frame) { return new PType.Alias( typeAlias.export(), - Arrays.stream(typeArgumentNodes).map(TypeNode::export).collect(Collectors.toList()), - aliasedTypeNode.doExport()); + Arrays.stream(typeArgumentNodes) + .map(it -> it.doExport(frame)) + .collect(Collectors.toList()), + aliasedTypeNode.doExport(frame)); } @Override @@ -2854,25 +2909,22 @@ public TypeNode initWriteSlotNode(int slot) { return this; } + private int getCustomThisSlot(VirtualFrame frame) { + var customThisSlot = + frame.getFrameDescriptor().getAuxiliarySlots().get(CustomThisScope.FRAME_SLOT_ID); + if (customThisSlot != null) return customThisSlot; + + CompilerDirectives.transferToInterpreterAndInvalidate(); + return frame.getFrameDescriptor().findOrAddAuxiliarySlot(CustomThisScope.FRAME_SLOT_ID); + } + @ExplodeLoop protected Object executeLazily(VirtualFrame frame, Object value) { - int customThisSlot; - var numberOfAuxiliarySlots = frame.getFrameDescriptor().getNumberOfAuxiliarySlots(); - if (numberOfAuxiliarySlots == 0) { - CompilerDirectives.transferToInterpreterAndInvalidate(); - customThisSlot = - frame.getFrameDescriptor().findOrAddAuxiliarySlot(CustomThisScope.FRAME_SLOT_ID); - } else { - // assertion: we only use auxiliary slots for custom `this`. - assert numberOfAuxiliarySlots == 1; - customThisSlot = 0; - } var ret = childNode.executeLazily(frame, value); - var localContext = language.localContext.get(); var prevShouldTypeCheck = localContext.shouldEagerTypecheck(); localContext.shouldEagerTypecheck(true); - frame.setAuxiliarySlot(customThisSlot, value); + frame.setAuxiliarySlot(getCustomThisSlot(frame), value); try { for (var node : constraintNodes) { node.execute(frame); @@ -2909,9 +2961,9 @@ public SourceSection getFirstConstraintSection() { } @Override - protected PType doExport() { + protected PType doExport(@Nullable VirtualFrame frame) { return new PType.Constrained( - childNode.doExport(), + childNode.doExport(frame), Arrays.stream(constraintNodes) .map(TypeConstraintNode::export) .collect(Collectors.toList())); diff --git a/pkl-core/src/main/java/org/pkl/core/ast/type/UnresolvedTypeNode.java b/pkl-core/src/main/java/org/pkl/core/ast/type/UnresolvedTypeNode.java index 22544d37b..d834020d8 100644 --- a/pkl-core/src/main/java/org/pkl/core/ast/type/UnresolvedTypeNode.java +++ b/pkl-core/src/main/java/org/pkl/core/ast/type/UnresolvedTypeNode.java @@ -103,8 +103,28 @@ public TypeNode execute(VirtualFrame frame) { var module = (VmTyped) getModuleNode.executeGeneric(frame); var moduleClass = module.getVmClass(); return moduleClass.isClosed() - ? new FinalModuleTypeNode(sourceSection, moduleClass) - : new NonFinalModuleTypeNode(sourceSection, moduleClass); + ? FinalSelfTypeNode.moduleType(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); } } diff --git a/pkl-core/src/main/java/org/pkl/core/repl/ReplServer.java b/pkl-core/src/main/java/org/pkl/core/repl/ReplServer.java index 3d9503919..0caf1ebd0 100644 --- a/pkl-core/src/main/java/org/pkl/core/repl/ReplServer.java +++ b/pkl-core/src/main/java/org/pkl/core/repl/ReplServer.java @@ -76,6 +76,7 @@ public class ReplServer implements AutoCloseable { private final @Nullable ProjectDependenciesManager projectDependenciesManager; private final boolean color; private final Parser parser = new Parser(); + private final Logger logger; public ReplServer( SecurityManager securityManager, @@ -99,6 +100,7 @@ public ReplServer( this.errorRenderer = new VmExceptionRenderer(new StackTraceRenderer(frameTransformer), color, true); this.color = color; + this.logger = logger; replState = new ReplState(createEmptyReplModule(BaseModule.getModuleClass().getPrototype())); var languageRef = new MutableReference(null); @@ -208,6 +210,7 @@ private void handleNode( new AstBuilder( VmUtils.loadSource(resolved), language, + logger, replState.module.getModuleInfo(), moduleResolver); var mod = parser.parseModule(syntheticModuleText); diff --git a/pkl-core/src/main/java/org/pkl/core/runtime/CommandSpecParser.java b/pkl-core/src/main/java/org/pkl/core/runtime/CommandSpecParser.java index 720dc8944..ddb58a66e 100644 --- a/pkl-core/src/main/java/org/pkl/core/runtime/CommandSpecParser.java +++ b/pkl-core/src/main/java/org/pkl/core/runtime/CommandSpecParser.java @@ -1042,10 +1042,12 @@ private CommandSpec.Result evaluateResult(VmTyped module, SubcommandState parent amendModuleNode.getModuleInfo().getModuleKey(), context.getSecurityManager(), context.getModuleResolver(), + context.getLogger(), VmUtils::createEmptyModule, ((moduleKey1, resolvedModuleKey, moduleResolver, + logger, source, emptyModule, importNode) -> { diff --git a/pkl-core/src/main/java/org/pkl/core/runtime/MirrorFactories.java b/pkl-core/src/main/java/org/pkl/core/runtime/MirrorFactories.java index e5083fb32..892d23acd 100644 --- a/pkl-core/src/main/java/org/pkl/core/runtime/MirrorFactories.java +++ b/pkl-core/src/main/java/org/pkl/core/runtime/MirrorFactories.java @@ -97,6 +97,9 @@ private MirrorFactories() {} public static final VmObjectFactory moduleTypeFactory = new VmObjectFactory<>(ReflectModule::getModuleTypeClass); + public static final VmObjectFactory thisTypeFactory = + new VmObjectFactory<>(ReflectModule::getThisTypeClass); + public static final VmObjectFactory unknownTypeFactory = new VmObjectFactory<>(ReflectModule::getUnknownTypeClass); diff --git a/pkl-core/src/main/java/org/pkl/core/runtime/ModuleCache.java b/pkl-core/src/main/java/org/pkl/core/runtime/ModuleCache.java index 3467a381c..54c9889a4 100644 --- a/pkl-core/src/main/java/org/pkl/core/runtime/ModuleCache.java +++ b/pkl-core/src/main/java/org/pkl/core/runtime/ModuleCache.java @@ -28,6 +28,7 @@ import java.util.function.Supplier; import java.util.stream.Collectors; import org.jspecify.annotations.Nullable; +import org.pkl.core.Logger; import org.pkl.core.Release; import org.pkl.core.SecurityManager; import org.pkl.core.SecurityManagerException; @@ -57,6 +58,7 @@ void initialize( ModuleKey moduleKey, ResolvedModuleKey resolvedModuleKey, ModuleResolver moduleResolver, + Logger logger, Source source, VmTyped emptyModule, @Nullable Node importNode); @@ -75,6 +77,7 @@ public synchronized VmTyped getOrLoad( ModuleKey moduleKey, SecurityManager securityManager, ModuleResolver moduleResolver, + Logger logger, Supplier moduleInstantiator, ModuleInitializer moduleInitializer, @Nullable Node importNode) { @@ -136,6 +139,7 @@ public synchronized VmTyped getOrLoad( moduleKey, resolvedKey, moduleResolver, + logger, moduleInstantiator, moduleInitializer, importNode); @@ -161,13 +165,20 @@ public synchronized VmTyped getOrLoad( } return doLoad( - moduleKey, resolvedKey, moduleResolver, moduleInstantiator, moduleInitializer, importNode); + moduleKey, + resolvedKey, + moduleResolver, + logger, + moduleInstantiator, + moduleInitializer, + importNode); } private VmTyped doLoad( ModuleKey moduleKey, ResolvedModuleKey resolvedKey, ModuleResolver moduleResolver, + Logger logger, Supplier moduleInstantiator, ModuleInitializer moduleInitializer, @Nullable Node importNode) { @@ -182,7 +193,7 @@ private VmTyped doLoad( modulesByResolvedUri.put(resolvedKey.getUri(), module); moduleInitializer.initialize( - moduleKey, resolvedKey, moduleResolver, result, module, importNode); + moduleKey, resolvedKey, moduleResolver, logger, result, module, importNode); } catch (Exception e) { // handle error deterministically by caching it and rethrowing it when the module is loaded // again diff --git a/pkl-core/src/main/java/org/pkl/core/runtime/ReflectModule.java b/pkl-core/src/main/java/org/pkl/core/runtime/ReflectModule.java index dc63aa845..d95d816f3 100644 --- a/pkl-core/src/main/java/org/pkl/core/runtime/ReflectModule.java +++ b/pkl-core/src/main/java/org/pkl/core/runtime/ReflectModule.java @@ -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"); * you may not use this file except in compliance with the License. @@ -84,6 +84,10 @@ public static VmClass getModuleTypeClass() { return ModuleTypeClass.instance; } + public static VmClass getThisTypeClass() { + return ThisTypeClass.instance; + } + public static VmClass getFunctionTypeClass() { return FunctionTypeClass.instance; } @@ -152,6 +156,10 @@ private static final class ModuleTypeClass { static final VmClass instance = loadClass("ModuleType"); } + private static final class ThisTypeClass { + static final VmClass instance = loadClass("ThisType"); + } + private static final class FunctionTypeClass { static final VmClass instance = loadClass("FunctionType"); } diff --git a/pkl-core/src/main/java/org/pkl/core/runtime/StdLibModule.java b/pkl-core/src/main/java/org/pkl/core/runtime/StdLibModule.java index df8bdec3a..9a0f0f8c9 100644 --- a/pkl-core/src/main/java/org/pkl/core/runtime/StdLibModule.java +++ b/pkl-core/src/main/java/org/pkl/core/runtime/StdLibModule.java @@ -72,6 +72,7 @@ private static void doLoad(URI uri, VmTyped instance) { moduleKey, (ResolvedModuleKey) moduleKey, vmContext.getModuleResolver(), + vmContext.getLogger(), source, instance, null); diff --git a/pkl-core/src/main/java/org/pkl/core/runtime/VmLanguage.java b/pkl-core/src/main/java/org/pkl/core/runtime/VmLanguage.java index 961026a9a..2f7d6e0e2 100644 --- a/pkl-core/src/main/java/org/pkl/core/runtime/VmLanguage.java +++ b/pkl-core/src/main/java/org/pkl/core/runtime/VmLanguage.java @@ -23,6 +23,7 @@ import com.oracle.truffle.api.nodes.Node; import com.oracle.truffle.api.source.Source; import org.jspecify.annotations.Nullable; +import org.pkl.core.Logger; import org.pkl.core.ast.builder.AstBuilder; import org.pkl.core.module.ModuleKey; import org.pkl.core.module.ResolvedModuleKey; @@ -70,6 +71,7 @@ public VmTyped loadModule(ModuleKey moduleKey) { moduleKey, context.getSecurityManager(), context.getModuleResolver(), + context.getLogger(), VmUtils::createEmptyModule, this::initializeModule, null); @@ -84,6 +86,7 @@ public VmTyped loadModule(ModuleKey moduleKey, @Nullable Node importNode) { moduleKey, context.getSecurityManager(), context.getModuleResolver(), + context.getLogger(), VmUtils::createEmptyModule, this::initializeModule, importNode); @@ -93,6 +96,7 @@ void initializeModule( ModuleKey moduleKey, ResolvedModuleKey resolvedModuleKey, ModuleResolver moduleResolver, + Logger logger, Source source, VmTyped emptyModule, @Nullable Node importNode) { @@ -109,7 +113,7 @@ void initializeModule( var builder = AstBuilder.create( - source, this, moduleContext, moduleKey, resolvedModuleKey, moduleResolver); + source, this, logger, moduleContext, moduleKey, resolvedModuleKey, moduleResolver); var moduleNode = builder.visitModule(moduleContext); moduleNode.getCallTarget().call(emptyModule, emptyModule); MinPklVersionChecker.check(emptyModule, importNode); diff --git a/pkl-core/src/main/java/org/pkl/core/runtime/VmReference.java b/pkl-core/src/main/java/org/pkl/core/runtime/VmReference.java index 09e56ea5b..2d77bb5e6 100644 --- a/pkl-core/src/main/java/org/pkl/core/runtime/VmReference.java +++ b/pkl-core/src/main/java/org/pkl/core/runtime/VmReference.java @@ -57,11 +57,7 @@ private static VmTyped newAccess(@Nullable String property, @Nullable Object key @TruffleBoundary public VmReference(VmTyped domain, VmClass clazz, Object data) { - this( - domain, - data, - RrbTree.empty(), - normalizeTypes(new PType.Class(clazz.export()), clazz.getModule().getVmClass().export())); + this(domain, data, RrbTree.empty(), normalizeTypes(new PType.Class(clazz.export()))); } public VmReference(VmTyped domain, Object data, ImRrbt path, PType referentType) { @@ -92,14 +88,18 @@ public PType getReferentType() { // * transforming T? into T|Null // * dereferencing aliases (except for well-known stdlib alias types) // * flattening unions - // * when moduleClass is supplied, replace PType.MODULE with appropriate PType.Class // * 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(); - normalizeTypes(type, moduleClass, types); + normalizeTypes(type, types, thisClass, moduleClass); return minimizeTypes(types); } + private static PType normalizeTypes(PType type) { + return normalizeTypes(type, null, null); + } + private static PType minimizeTypes(Set types) { if (types.size() == 1) return types.iterator().next(); // optimization: unknown allows all references, erase all candidates to only unknown @@ -112,7 +112,8 @@ private static PType minimizeTypes(Set types) { return new PType.Union(typesList); } - private static void normalizeTypes(PType type, PClass moduleClass, Set result) { + private static void normalizeTypes( + PType type, Set result, @Nullable PType thisClass, @Nullable PType moduleClass) { if (type == PType.UNKNOWN || type == PType.NOTHING || type instanceof PType.StringLiteral) { result.add(type); } else if (type instanceof PType.Class clazz) { @@ -128,35 +129,50 @@ private static void normalizeTypes(PType type, PClass moduleClass, Set re } else { var typeArgs = new ArrayList(clazz.getTypeArguments().size()); for (var arg : clazz.getTypeArguments()) { - typeArgs.add(normalizeTypes(arg, moduleClass)); + typeArgs.add(normalizeTypes(arg, thisClass, moduleClass)); } result.add(new PType.Class(clazz.getPClass(), typeArgs)); } } // normalize `T?` to `T | Null` 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())); // erase `T(someConstraint)` to `T` } 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) { if (isPreservedTypeAlias(alias.getTypeAlias())) { result.add(alias); } else { - normalizeTypes(alias.getAliasedType(), alias.getTypeAlias().getModuleClass(), result); + normalizeTypes(alias.getAliasedType(), result, thisClass, moduleClass); } } else if (type instanceof PType.Union union) { 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, and only property access can produce THIS or MODULE: + // 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 + // getCandidatePropertyType always passes a value for thisClass, which is null in other cases + result.add(thisClass); } 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 { // 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 // if accessed. result.add(type); + // PType.MODULE and PType.THIS can never be encountered here; caller must deref self types } } @@ -243,7 +259,8 @@ private static void getCandidatePropertyType(PType type, String property, Set getClassInfo(Object value) { @@ -273,19 +290,19 @@ private static void getCandidateSubscriptType(PType type, Object key, Set if (!(key instanceof Long)) { 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; } if (clazz.getPClass().getInfo() == PClassInfo.Mapping || clazz.getPClass().getInfo() == PClassInfo.Map) { var typeArgs = clazz.getTypeArguments(); - var keyTypes = normalizeTypes(typeArgs.get(0), clazz.getPClass().getModuleClass()); + var keyTypes = normalizeTypes(typeArgs.get(0)); for (var kt : iterateTypes(keyTypes)) { if (kt == PType.UNKNOWN || (kt instanceof PType.Class klazz && klazz.getPClass().getInfo() == getClassInfo(key)) || (kt instanceof PType.StringLiteral stringLiteral && stringLiteral.getLiteral().equals(key))) { - normalizeTypes(typeArgs.get(1), clazz.getPClass().getModuleClass(), result); + normalizeTypes(typeArgs.get(1), result, null, null); return; } } @@ -303,13 +320,14 @@ private static void getCandidateSubscriptType(PType type, Object key, Set /** * 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) { // fast path: if referent is unknown it can match any type check if (referentType == PType.UNKNOWN) { return true; } - var checkType = normalizeTypes(type, moduleClass); + var checkType = normalizeTypes(type); // fast path: short circuit if any referent is accepted if (checkType == PType.UNKNOWN || isClass(checkType, BaseModule.getAnyClass().export())) { return true; diff --git a/pkl-core/src/main/java/org/pkl/core/runtime/VmTypeAlias.java b/pkl-core/src/main/java/org/pkl/core/runtime/VmTypeAlias.java index 4f4feea84..cf57cc824 100644 --- a/pkl-core/src/main/java/org/pkl/core/runtime/VmTypeAlias.java +++ b/pkl-core/src/main/java/org/pkl/core/runtime/VmTypeAlias.java @@ -231,6 +231,7 @@ public void force(boolean allowUndefinedValues) { } @Override + @TruffleBoundary public TypeAlias export() { synchronized (pTypeAliasLock) { if (__pTypeAlias == null) { diff --git a/pkl-core/src/main/java/org/pkl/core/runtime/VmUtils.java b/pkl-core/src/main/java/org/pkl/core/runtime/VmUtils.java index 7ddcbf5dd..94613a8d1 100644 --- a/pkl-core/src/main/java/org/pkl/core/runtime/VmUtils.java +++ b/pkl-core/src/main/java/org/pkl/core/runtime/VmUtils.java @@ -40,6 +40,7 @@ import org.jspecify.annotations.Nullable; import org.organicdesign.fp.collections.ImMap; import org.pkl.core.FileOutput; +import org.pkl.core.Logger; import org.pkl.core.PClassInfo; import org.pkl.core.PObject; import org.pkl.core.SecurityManager; @@ -989,7 +990,8 @@ public static Object evaluateExpression( VmTyped module, String expression, SecurityManager securityManager, - ModuleResolver moduleResolver) { + ModuleResolver moduleResolver, + Logger logger) { org.pkl.parser.syntax.Node node; try { node = parser.parseExpressionInput(expression); @@ -1019,7 +1021,7 @@ public static Object evaluateExpression( resolvedModule, false); var language = VmLanguage.get(null); - var builder = new AstBuilder(source, language, moduleInfo, moduleResolver); + var builder = new AstBuilder(source, language, logger, moduleInfo, moduleResolver); var mod = parser.parseModule(syntheticModuleText); builder.visitModule(mod); var exprNode = builder.visitExpr((Expr) adjustedNode); diff --git a/pkl-core/src/main/java/org/pkl/core/stdlib/reflect/ReflectNodes.java b/pkl-core/src/main/java/org/pkl/core/stdlib/reflect/ReflectNodes.java index fca719073..ac98fe8cb 100644 --- a/pkl-core/src/main/java/org/pkl/core/stdlib/reflect/ReflectNodes.java +++ b/pkl-core/src/main/java/org/pkl/core/stdlib/reflect/ReflectNodes.java @@ -137,6 +137,14 @@ protected VmTyped eval(VmTyped self) { } } + 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 { @Specialization @TruffleBoundary diff --git a/pkl-core/src/main/resources/org/pkl/core/errorMessages.properties b/pkl-core/src/main/resources/org/pkl/core/errorMessages.properties index b1e52a977..1c45d8a43 100644 --- a/pkl-core/src/main/resources/org/pkl/core/errorMessages.properties +++ b/pkl-core/src/main/resources/org/pkl/core/errorMessages.properties @@ -1208,3 +1208,6 @@ invalidReferenceTypeAnnotationWithConstraint=\ cannotInstallPackageWithNoCache=\ Cannot install package to module cache dir when module cache is disabled. + +invalidSelfTypeUsage=\ +Cannot declare `{0}` types inside {1} bodies. diff --git a/pkl-core/src/test/files/LanguageSnippetTests/input-helper/api/reflect/BaseModule.pkl b/pkl-core/src/test/files/LanguageSnippetTests/input-helper/api/reflect/BaseModule.pkl index c40eb271b..ef5589ee2 100644 --- a/pkl-core/src/test/files/LanguageSnippetTests/input-helper/api/reflect/BaseModule.pkl +++ b/pkl-core/src/test/files/LanguageSnippetTests/input-helper/api/reflect/BaseModule.pkl @@ -48,6 +48,8 @@ nullable: Person? stringLiteral: "yes" constrained: String(length.isBetween(3, 10)) aliased: MyMap +mod: module +self: this hidden hiddenProp: String const constProp: String = "the const prop" diff --git a/pkl-core/src/test/files/LanguageSnippetTests/input-helper/types/aliasHolder.pkl b/pkl-core/src/test/files/LanguageSnippetTests/input-helper/types/aliasHolder.pkl new file mode 100644 index 000000000..f9d46ff24 --- /dev/null +++ b/pkl-core/src/test/files/LanguageSnippetTests/input-helper/types/aliasHolder.pkl @@ -0,0 +1 @@ +typealias MyList = List diff --git a/pkl-core/src/test/files/LanguageSnippetTests/input-helper/types/moduleTypeProperty.pkl b/pkl-core/src/test/files/LanguageSnippetTests/input-helper/types/moduleTypeProperty.pkl new file mode 100644 index 000000000..3a0079fbb --- /dev/null +++ b/pkl-core/src/test/files/LanguageSnippetTests/input-helper/types/moduleTypeProperty.pkl @@ -0,0 +1,6 @@ +open module moduleTypeProperty + +x = 1 +y = mod.x +modName = module.getClass().toString() +hidden mod: module diff --git a/pkl-core/src/test/files/LanguageSnippetTests/input/api/reference.pkl b/pkl-core/src/test/files/LanguageSnippetTests/input/api/reference.pkl index dddfb0712..2539e55d0 100644 --- a/pkl-core/src/test/files/LanguageSnippetTests/input/api/reference.pkl +++ b/pkl-core/src/test/files/LanguageSnippetTests/input/api/reference.pkl @@ -1,8 +1,9 @@ import "pkl:math" import "pkl:ref" +import "pkl:test" class D extends ref.Domain { - function renderReference(reference: ref.Reference): String = + function renderReference(reference: ref.Reference): String = let (data = reference.getData()) let (root = if (data is Resource) data.name else data.toString()) let ( @@ -19,13 +20,12 @@ typealias Ref = ref.Reference abstract class Resource { name: String - hidden fixed $: Ref + hidden fixed $: Ref = ref.Reference(d, getClass(), this) } class A extends Resource { id: String hidden outputs: AProperties - hidden fixed $: Ref = ref.Reference(d, A, this) } /// Test doc comment @@ -42,7 +42,6 @@ class AProperties { class B extends Resource { id: String hidden outputs: BProperties - hidden fixed $: Ref = ref.Reference(d, B, this) } class BProperties { @@ -128,6 +127,13 @@ class TypeHolder { prop: Listing } +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 { renderer { converters { diff --git a/pkl-core/src/test/files/LanguageSnippetTests/input/api/reflect1.pkl b/pkl-core/src/test/files/LanguageSnippetTests/input/api/reflect1.pkl index 4ff5e4be7..ac7e12543 100644 --- a/pkl-core/src/test/files/LanguageSnippetTests/input/api/reflect1.pkl +++ b/pkl-core/src/test/files/LanguageSnippetTests/input/api/reflect1.pkl @@ -48,6 +48,8 @@ facts { modClassProps["aliased"].type == reflect.DeclaredType(reflect.TypeAlias(BaseModule.MyMap)) .withTypeArgument(reflect.DeclaredType(reflect.Class(BaseModule.Person))) + modClassProps["mod"].type == reflect.moduleType + modClassProps["self"].type == reflect.thisType } ["Reflecting a class"] { diff --git a/pkl-core/src/test/files/LanguageSnippetTests/input/basic/reference.pkl b/pkl-core/src/test/files/LanguageSnippetTests/input/basic/reference.pkl index 336f0165e..650afc846 100644 --- a/pkl-core/src/test/files/LanguageSnippetTests/input/basic/reference.pkl +++ b/pkl-core/src/test/files/LanguageSnippetTests/input/basic/reference.pkl @@ -3,7 +3,7 @@ amends "../snippetTest.pkl" import "pkl:ref" local class D extends ref.Domain { - function renderReference(reference: ref.Reference): String = reference.getData().toString() + function renderReference(reference: ref.Reference): String = reference.getData().toString() } local const d: D = new {} diff --git a/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference1.pkl b/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference1.pkl index 0465c5bfe..b61c0ac5f 100644 --- a/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference1.pkl +++ b/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference1.pkl @@ -1,7 +1,7 @@ import "pkl:ref" class D extends ref.Domain { - function renderReference(reference: ref.Reference): String = throw("not supported") + function renderReference(reference: ref.Reference): String = throw("not supported") } local d: D = new {} typealias Ref = ref.Reference diff --git a/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference10.pkl b/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference10.pkl index bb145f685..485f5b440 100644 --- a/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference10.pkl +++ b/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference10.pkl @@ -1,7 +1,7 @@ import "pkl:ref" class D extends ref.Domain { - function renderReference(reference: ref.Reference): String = throw("not supported") + function renderReference(reference: ref.Reference): String = throw("not supported") } typealias Ref = ref.Reference local d: D = new {} diff --git a/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference11.pkl b/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference11.pkl index 8e1daebc4..b6f276202 100644 --- a/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference11.pkl +++ b/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference11.pkl @@ -1,7 +1,7 @@ import "pkl:ref" class D extends ref.Domain { - function renderReference(reference: ref.Reference): String = throw("not supported") + function renderReference(reference: ref.Reference): String = throw("not supported") } typealias Ref = ref.Reference local d: D = new {} diff --git a/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference12.pkl b/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference12.pkl index 576d7d287..ce04958f7 100644 --- a/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference12.pkl +++ b/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference12.pkl @@ -1,7 +1,7 @@ import "pkl:ref" class D extends ref.Domain { - function renderReference(reference: ref.Reference): String = throw("not supported") + function renderReference(reference: ref.Reference): String = throw("not supported") } typealias RefAlias1 = ref.Reference local d: D = new {} diff --git a/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference13.pkl b/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference13.pkl index 489f46661..87cb0615a 100644 --- a/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference13.pkl +++ b/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference13.pkl @@ -1,7 +1,7 @@ import "pkl:ref" class D extends ref.Domain { - function renderReference(reference: ref.Reference): String = throw("not supported") + function renderReference(reference: ref.Reference): String = throw("not supported") } local d: D = new {} diff --git a/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference14.pkl b/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference14.pkl index 47bbe6628..b19940d3b 100644 --- a/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference14.pkl +++ b/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference14.pkl @@ -1,7 +1,7 @@ import "pkl:ref" class D extends ref.Domain { - function renderReference(reference: ref.Reference): String = throw("not supported") + function renderReference(reference: ref.Reference): String = throw("not supported") } local d: D = new {} diff --git a/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference15.pkl b/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference15.pkl index 4f82ef2af..2c3b7ab2a 100644 --- a/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference15.pkl +++ b/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference15.pkl @@ -1,7 +1,7 @@ import "pkl:ref" class D extends ref.Domain { - function renderReference(reference: ref.Reference): String = throw("not supported") + function renderReference(reference: ref.Reference): String = throw("not supported") } local d: D = new {} diff --git a/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference16.pkl b/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference16.pkl index 1519c25db..3f80f1112 100644 --- a/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference16.pkl +++ b/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference16.pkl @@ -3,7 +3,7 @@ import "pkl:ref" import ".../input-helper/errors/ReferencedModule.pkl" class D extends ref.Domain { - function renderReference(reference: ref.Reference): String = throw("not supported") + function renderReference(reference: ref.Reference): String = throw("not supported") } local d: D = new {} diff --git a/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference17.pkl b/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference17.pkl index 81d697e2a..af693df83 100644 --- a/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference17.pkl +++ b/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference17.pkl @@ -3,7 +3,7 @@ import "pkl:ref" import ".../input-helper/errors/ReferencedModuleWithOutputOverride.pkl" class D extends ref.Domain { - function renderReference(reference: ref.Reference): String = throw("not supported") + function renderReference(reference: ref.Reference): String = throw("not supported") } local d: D = new {} diff --git a/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference18.pkl b/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference18.pkl index 7a916c524..a8a418f8c 100644 --- a/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference18.pkl +++ b/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference18.pkl @@ -5,7 +5,7 @@ import ".../input-helper/errors/ReferencedModuleWithOutputOverride.pkl" class ModuleSubclass extends ReferencedModuleWithOutputOverride class D extends ref.Domain { - function renderReference(reference: ref.Reference): String = throw("not supported") + function renderReference(reference: ref.Reference): String = throw("not supported") } local d: D = new {} diff --git a/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference19.pkl b/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference19.pkl index 2e4ff0a74..042272748 100644 --- a/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference19.pkl +++ b/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference19.pkl @@ -5,7 +5,7 @@ class A { } class D extends ref.Domain { - function renderReference(reference: ref.Reference): String = throw("not supported") + function renderReference(reference: ref.Reference): String = throw("not supported") } local d: D = new {} diff --git a/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference2.pkl b/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference2.pkl index a942c2034..a5519badf 100644 --- a/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference2.pkl +++ b/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference2.pkl @@ -1,7 +1,7 @@ import "pkl:ref" class D extends ref.Domain { - function renderReference(reference: ref.Reference): String = throw("not supported") + function renderReference(reference: ref.Reference): String = throw("not supported") } local d: D = new {} typealias Ref = ref.Reference diff --git a/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference20.pkl b/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference20.pkl index 417c9f3a0..d0311d6d0 100644 --- a/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference20.pkl +++ b/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference20.pkl @@ -5,11 +5,11 @@ class A { } class D extends ref.Domain { - function renderReference(reference: ref.Reference): String = throw("not supported") + function renderReference(reference: ref.Reference): String = throw("not supported") } local d: D = new {} local test = ref.Reference(d, A, "").foo 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 diff --git a/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference28.pkl b/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference28.pkl new file mode 100644 index 000000000..bb700ede3 --- /dev/null +++ b/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference28.pkl @@ -0,0 +1,45 @@ +// interactions between references and self types + +import "pkl:ref" + +class D extends ref.Domain { + function renderReference(r: ref.Reference): String = + r.getPath().map((it) -> it.property ?? it.key.toString()).join(".") +} + +// this type in a final class +class Node { + parent: this? + children: List +} + +// this type in an open class +open class Node2 { + parent: this? + children: List +} + +typealias R = ref.Reference +typealias R2 = ref.Reference + +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() + } + } +} diff --git a/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference29.pkl b/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference29.pkl new file mode 100644 index 000000000..ebcdf8bba --- /dev/null +++ b/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference29.pkl @@ -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): String = + r.getPath().map((it) -> it.property ?? it.key.toString()).join(".") +} + +hidden parent: module? +hidden children: List + +typealias R = ref.Reference + +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() + } + } +} diff --git a/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference3.pkl b/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference3.pkl index 182046e4c..3037c05b0 100644 --- a/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference3.pkl +++ b/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference3.pkl @@ -1,7 +1,7 @@ import "pkl:ref" class D extends ref.Domain { - function renderReference(reference: ref.Reference): String = throw("not supported") + function renderReference(reference: ref.Reference): String = throw("not supported") } local d: D = new {} typealias Ref = ref.Reference diff --git a/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference30.pkl b/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference30.pkl new file mode 100644 index 000000000..662fec0da --- /dev/null +++ b/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference30.pkl @@ -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): String = + r.getPath().map((it) -> it.property ?? it.key.toString()).join(".") +} + +hidden parent: module? +hidden children: List + +typealias R = ref.Reference + +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() + } + } +} diff --git a/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference4.pkl b/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference4.pkl index a48fa5dab..b6eefabb6 100644 --- a/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference4.pkl +++ b/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference4.pkl @@ -1,7 +1,7 @@ import "pkl:ref" class D extends ref.Domain { - function renderReference(reference: ref.Reference): String = throw("not supported") + function renderReference(reference: ref.Reference): String = throw("not supported") } local d: D = new {} typealias Ref = ref.Reference diff --git a/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference5.pkl b/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference5.pkl index 1a7365af4..a570ea49e 100644 --- a/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference5.pkl +++ b/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference5.pkl @@ -1,13 +1,13 @@ import "pkl:ref" class D extends ref.Domain { - function renderReference(reference: ref.Reference): String = throw("not supported") + function renderReference(reference: ref.Reference): String = throw("not supported") } local d: D = new {} typealias Ref = ref.Reference class D2 extends ref.Domain { - function renderReference(reference: ref.Reference): String = throw("not supported") + function renderReference(reference: ref.Reference): String = throw("not supported") } local d2: D2 = new {} diff --git a/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference6.pkl b/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference6.pkl index 7ab3faed2..088305c3e 100644 --- a/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference6.pkl +++ b/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference6.pkl @@ -1,7 +1,7 @@ import "pkl:ref" class D extends ref.Domain { - function renderReference(reference: ref.Reference): String = throw("not supported") + function renderReference(reference: ref.Reference): String = throw("not supported") } local d: D = new {} typealias Ref = ref.Reference diff --git a/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference7.pkl b/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference7.pkl index 649ddd426..6bd109fec 100644 --- a/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference7.pkl +++ b/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference7.pkl @@ -1,7 +1,7 @@ import "pkl:ref" class D extends ref.Domain { - function renderReference(reference: ref.Reference): String = throw("not supported") + function renderReference(reference: ref.Reference): String = throw("not supported") } local d: D = new {} typealias Ref = ref.Reference diff --git a/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference8.pkl b/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference8.pkl index 0dff11cbe..fcf66b49d 100644 --- a/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference8.pkl +++ b/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference8.pkl @@ -1,7 +1,7 @@ import "pkl:ref" class D extends ref.Domain { - function renderReference(reference: ref.Reference): String = throw("not supported") + function renderReference(reference: ref.Reference): String = throw("not supported") } typealias Ref = ref.Reference local d: D = new {} diff --git a/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference9.pkl b/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference9.pkl index 2fa7bf21f..66faa0409 100644 --- a/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference9.pkl +++ b/pkl-core/src/test/files/LanguageSnippetTests/input/errors/reference9.pkl @@ -1,7 +1,7 @@ import "pkl:ref" class D extends ref.Domain { - function renderReference(reference: ref.Reference): String = throw("not supported") + function renderReference(reference: ref.Reference): String = throw("not supported") } typealias Ref = ref.Reference local d: D = new {} diff --git a/pkl-core/src/test/files/LanguageSnippetTests/input/types/currentModuleType1.pkl b/pkl-core/src/test/files/LanguageSnippetTests/input/types/currentModuleType1.pkl index d916201ee..f5259a4c7 100644 --- a/pkl-core/src/test/files/LanguageSnippetTests/input/types/currentModuleType1.pkl +++ b/pkl-core/src/test/files/LanguageSnippetTests/input/types/currentModuleType1.pkl @@ -42,15 +42,15 @@ output { // force eval but don't render to prevent recursion value = let (r1 = res1) - let (r2 = res2) - let (r3 = res3) - let (r4 = res4) - let (r5 = res5) - let (r6 = res6) - let (r6a = res6a) - let (r7 = res7) - let (r8 = res8) - let (r9 = res9) - let (r10 = res10) - new Dynamic { result = "ok" } + let (r2 = res2) + let (r3 = res3) + let (r4 = res4) + let (r5 = res5) + let (r6 = res6) + let (r6a = res6a) + let (r7 = res7) + let (r8 = res8) + let (r9 = res9) + let (r10 = res10) + new Dynamic { result = "ok" } } diff --git a/pkl-core/src/test/files/LanguageSnippetTests/input/types/currentModuleType2.pkl b/pkl-core/src/test/files/LanguageSnippetTests/input/types/currentModuleType2.pkl index 9b843c3ff..8127beed6 100644 --- a/pkl-core/src/test/files/LanguageSnippetTests/input/types/currentModuleType2.pkl +++ b/pkl-core/src/test/files/LanguageSnippetTests/input/types/currentModuleType2.pkl @@ -44,15 +44,15 @@ output { // force eval but don't render to prevent recursion value = let (r1 = res1) - let (r2 = res2) - let (r3 = res3) - let (r4 = res4) - let (r5 = res5) - let (r6 = res6) - let (r6a = res6a) - let (r7 = res7) - let (r8 = res8) - let (r9 = res9) - let (r10 = res10) - new Dynamic { result = "ok" } + let (r2 = res2) + let (r3 = res3) + let (r4 = res4) + let (r5 = res5) + let (r6 = res6) + let (r6a = res6a) + let (r7 = res7) + let (r8 = res8) + let (r9 = res9) + let (r10 = res10) + new Dynamic { result = "ok" } } diff --git a/pkl-core/src/test/files/LanguageSnippetTests/input/types/currentModuleType4.pkl b/pkl-core/src/test/files/LanguageSnippetTests/input/types/currentModuleType4.pkl new file mode 100644 index 000000000..886404c8d --- /dev/null +++ b/pkl-core/src/test/files/LanguageSnippetTests/input/types/currentModuleType4.pkl @@ -0,0 +1,5 @@ +typealias Foo = module + +class Bar { + baz: module +} diff --git a/pkl-core/src/test/files/LanguageSnippetTests/input/types/currentModuleType5.pkl b/pkl-core/src/test/files/LanguageSnippetTests/input/types/currentModuleType5.pkl new file mode 100644 index 000000000..07073f7a2 --- /dev/null +++ b/pkl-core/src/test/files/LanguageSnippetTests/input/types/currentModuleType5.pkl @@ -0,0 +1,7 @@ +open module currentModuleType5 + +import ".../input-helper/types/aliasHolder.pkl" + +local foo: aliasHolder.MyList = List(this) +x = 1 +y = foo.first.x diff --git a/pkl-core/src/test/files/LanguageSnippetTests/input/types/currentModuleType6.pkl b/pkl-core/src/test/files/LanguageSnippetTests/input/types/currentModuleType6.pkl new file mode 100644 index 000000000..aeb3e119e --- /dev/null +++ b/pkl-core/src/test/files/LanguageSnippetTests/input/types/currentModuleType6.pkl @@ -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) diff --git a/pkl-core/src/test/files/LanguageSnippetTests/input/types/currentModuleType7.pkl b/pkl-core/src/test/files/LanguageSnippetTests/input/types/currentModuleType7.pkl new file mode 100644 index 000000000..725947381 --- /dev/null +++ b/pkl-core/src/test/files/LanguageSnippetTests/input/types/currentModuleType7.pkl @@ -0,0 +1,19 @@ +// test that `module` type use in annotations is allowed +@Foo { baz = bar is module } +module currentModuleType7 + +@Foo { baz = bar is module } +typealias Qux = Foo + +@Foo { baz = bar is module } +class Quux { + @Foo { baz = bar is module } + corge = 2 +} + +class Foo extends Annotation { + bar: Int = 1 + baz: Boolean +} + +ok = true diff --git a/pkl-core/src/test/files/LanguageSnippetTests/input/types/thisType1.pkl b/pkl-core/src/test/files/LanguageSnippetTests/input/types/thisType1.pkl new file mode 100644 index 000000000..a7049e47b --- /dev/null +++ b/pkl-core/src/test/files/LanguageSnippetTests/input/types/thisType1.pkl @@ -0,0 +1,120 @@ +open module thisType1 + +import "pkl:test" + +x: Int = 1 + +res1: this = module + +res2: this = this + +res3: this = (this) { x = super.x + 1 } + +res4: this? = null + +res5: List = List(this, (this) { x = super.x + 2 }) + +res6: List = fun(this) + +res6a: this = res6[0] + +res6b: this = fun(new Good { x = 3 })[0] + +function fun(m: this): List = + let (_x = x) + List((m) { x = super.x + _x }) + +typealias Foo = T + +function fun2(m: Foo): List = + 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 = 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 +} + +res11 = new Good {} + +res12 = test.catch(() -> res11.fun(module)[0].x) + +// this type not affected by custom this scope: +res13: List(this is List) = List(module) + +// test generic typealias through inheritance from module +res14 = fun2(this) +res14a = test.catch(() -> res11.fun2(this)) +res14b = res11.fun2(res11) + +// test generic typealias without inheritance from module +open class A { + x: Int = 1 + function fun2(m: Foo): List = + 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) + +output { + // force eval but don't render to prevent recursion + value = + let (_ = res1) + let (_ = res2) + let (_ = res3) + let (_ = res4) + let (_ = res5) + let (_ = res6) + let (_ = res6a) + let (_ = res6b) + let (_ = res7) + let (_ = res8) + let (_ = res9) + let (_ = res10) + let (_ = res11) + let (_ = res13) + let (_ = res14) + let (_ = res14a) + let (_ = res14b) + let (_ = res15) + let (_ = res15a) + let (_ = res15b) + new Dynamic { + result = "ok" + res1a = res1.res2.x + res1b = res1.res3.x + res1c = res1.res5[1].x + res1d = res1.res6a.x + res11a = res11.res2.x + res11b = res11.res3.x + res11c = res11.res5[1].x + res11d = res11.res6a.x + res12 = module.res12 + res14a = module.res14a + } +} diff --git a/pkl-core/src/test/files/LanguageSnippetTests/input/types/thisType2.pkl b/pkl-core/src/test/files/LanguageSnippetTests/input/types/thisType2.pkl new file mode 100644 index 000000000..bb2a52c2b --- /dev/null +++ b/pkl-core/src/test/files/LanguageSnippetTests/input/types/thisType2.pkl @@ -0,0 +1 @@ +typealias Foo = this diff --git a/pkl-core/src/test/files/LanguageSnippetTests/input/types/thisType3.pkl b/pkl-core/src/test/files/LanguageSnippetTests/input/types/thisType3.pkl new file mode 100644 index 000000000..1310596d2 --- /dev/null +++ b/pkl-core/src/test/files/LanguageSnippetTests/input/types/thisType3.pkl @@ -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 +} diff --git a/pkl-core/src/test/files/LanguageSnippetTests/input/types/thisType4.pkl b/pkl-core/src/test/files/LanguageSnippetTests/input/types/thisType4.pkl new file mode 100644 index 000000000..815977a9f --- /dev/null +++ b/pkl-core/src/test/files/LanguageSnippetTests/input/types/thisType4.pkl @@ -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 +} diff --git a/pkl-core/src/test/files/LanguageSnippetTests/input/types/thisType5.pkl b/pkl-core/src/test/files/LanguageSnippetTests/input/types/thisType5.pkl new file mode 100644 index 000000000..525d4a792 --- /dev/null +++ b/pkl-core/src/test/files/LanguageSnippetTests/input/types/thisType5.pkl @@ -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 {}) diff --git a/pkl-core/src/test/files/LanguageSnippetTests/output/api/reference.pcf b/pkl-core/src/test/files/LanguageSnippetTests/output/api/reference.pcf index edd5f67aa..7e5605e56 100644 --- a/pkl-core/src/test/files/LanguageSnippetTests/output/api/reference.pcf +++ b/pkl-core/src/test/files/LanguageSnippetTests/output/api/reference.pcf @@ -60,3 +60,4 @@ aValuesJoined = """ ${b.outputs.nonString} """ typeArgs = "${null.prop}" +badThisRef = "Expected value of type `pkl.ref#Reference`, but got type `pkl.ref#Reference`. Value: Reference(new D {}, reference#A, new BadResource { name = ? })" diff --git a/pkl-core/src/test/files/LanguageSnippetTests/output/api/reflect1.pcf b/pkl-core/src/test/files/LanguageSnippetTests/output/api/reflect1.pcf index 77e58501c..3124707f6 100644 --- a/pkl-core/src/test/files/LanguageSnippetTests/output/api/reflect1.pcf +++ b/pkl-core/src/test/files/LanguageSnippetTests/output/api/reflect1.pcf @@ -26,6 +26,8 @@ facts { true true true + true + true } ["Reflecting a class"] { true @@ -67,7 +69,7 @@ facts { } examples { ["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 { hasExpectedLocation = true docComment = "module property doc comment" diff --git a/pkl-core/src/test/files/LanguageSnippetTests/output/errors/reference20.err b/pkl-core/src/test/files/LanguageSnippetTests/output/errors/reference20.err index 08663a8a8..470beada2 100644 --- a/pkl-core/src/test/files/LanguageSnippetTests/output/errors/reference20.err +++ b/pkl-core/src/test/files/LanguageSnippetTests/output/errors/reference20.err @@ -1,8 +1,8 @@ –– Pkl Error –– not supported -x | function renderReference(reference: ref.Reference): String = throw("not supported") - ^^^^^^^^^^^^^^^^^^^^^^ +x | function renderReference(reference: ref.Reference): String = throw("not supported") + ^^^^^^^^^^^^^^^^^^^^^^ at reference20#D.renderReference (file:///$snippetsDir/input/errors/reference20.pkl) xxx | function toString(): String = getDomain().renderReference(this) diff --git a/pkl-core/src/test/files/LanguageSnippetTests/output/errors/reference28.pcf b/pkl-core/src/test/files/LanguageSnippetTests/output/errors/reference28.pcf new file mode 100644 index 000000000..989abf8f6 --- /dev/null +++ b/pkl-core/src/test/files/LanguageSnippetTests/output/errors/reference28.pcf @@ -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" diff --git a/pkl-core/src/test/files/LanguageSnippetTests/output/errors/reference29.pcf b/pkl-core/src/test/files/LanguageSnippetTests/output/errors/reference29.pcf new file mode 100644 index 000000000..81ac88430 --- /dev/null +++ b/pkl-core/src/test/files/LanguageSnippetTests/output/errors/reference29.pcf @@ -0,0 +1,6 @@ +res0 = "" +res1 = "parent" +res2 = "parent.parent" +res3 = "children.0" +res4 = "children.0.parent" +res5 = "children.0.children.0" diff --git a/pkl-core/src/test/files/LanguageSnippetTests/output/errors/reference30.pcf b/pkl-core/src/test/files/LanguageSnippetTests/output/errors/reference30.pcf new file mode 100644 index 000000000..81ac88430 --- /dev/null +++ b/pkl-core/src/test/files/LanguageSnippetTests/output/errors/reference30.pcf @@ -0,0 +1,6 @@ +res0 = "" +res1 = "parent" +res2 = "parent.parent" +res3 = "children.0" +res4 = "children.0.parent" +res5 = "children.0.children.0" diff --git a/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType1.err b/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType1.err new file mode 100644 index 000000000..958b97784 --- /dev/null +++ b/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType1.err @@ -0,0 +1,5 @@ +result = "ok" +pkl: WARN: Cannot declare `module` types inside class bodies. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType1.pkl) +pkl: WARN: Cannot declare `module` types inside class bodies. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType1.pkl) +pkl: WARN: Cannot declare `module` types inside class bodies. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType1.pkl) +pkl: WARN: Cannot declare `module` types inside class bodies. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType1.pkl) diff --git a/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType1.pcf b/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType1.pcf deleted file mode 100644 index 53dc6b389..000000000 --- a/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType1.pcf +++ /dev/null @@ -1 +0,0 @@ -result = "ok" diff --git a/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType2.err b/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType2.err new file mode 100644 index 000000000..e9eab50e0 --- /dev/null +++ b/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType2.err @@ -0,0 +1,5 @@ +result = "ok" +pkl: WARN: Cannot declare `module` types inside class bodies. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType2.pkl) +pkl: WARN: Cannot declare `module` types inside class bodies. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType2.pkl) +pkl: WARN: Cannot declare `module` types inside class bodies. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType2.pkl) +pkl: WARN: Cannot declare `module` types inside class bodies. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType2.pkl) diff --git a/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType2.pcf b/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType2.pcf deleted file mode 100644 index 53dc6b389..000000000 --- a/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType2.pcf +++ /dev/null @@ -1 +0,0 @@ -result = "ok" diff --git a/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType3.err b/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType3.err new file mode 100644 index 000000000..e9eab50e0 --- /dev/null +++ b/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType3.err @@ -0,0 +1,5 @@ +result = "ok" +pkl: WARN: Cannot declare `module` types inside class bodies. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType2.pkl) +pkl: WARN: Cannot declare `module` types inside class bodies. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType2.pkl) +pkl: WARN: Cannot declare `module` types inside class bodies. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType2.pkl) +pkl: WARN: Cannot declare `module` types inside class bodies. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType2.pkl) diff --git a/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType3.pcf b/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType3.pcf deleted file mode 100644 index 53dc6b389..000000000 --- a/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType3.pcf +++ /dev/null @@ -1 +0,0 @@ -result = "ok" diff --git a/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType4.err b/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType4.err new file mode 100644 index 000000000..d3a798bef --- /dev/null +++ b/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType4.err @@ -0,0 +1,2 @@ +pkl: WARN: Cannot declare `module` types inside class bodies. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType4.pkl) +pkl: WARN: Cannot declare `module` types inside type alias bodies. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType4.pkl) diff --git a/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType5.pcf b/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType5.pcf new file mode 100644 index 000000000..1248f1e07 --- /dev/null +++ b/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType5.pcf @@ -0,0 +1,2 @@ +x = 1 +y = 1 diff --git a/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType6.err b/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType6.err new file mode 100644 index 000000000..0b2bb10f2 --- /dev/null +++ b/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType6.err @@ -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 declare `module` types inside class bodies. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType6.pkl) diff --git a/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType7.pcf b/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType7.pcf new file mode 100644 index 000000000..0198e4182 --- /dev/null +++ b/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType7.pcf @@ -0,0 +1 @@ +ok = true diff --git a/pkl-core/src/test/files/LanguageSnippetTests/output/types/thisType1.pcf b/pkl-core/src/test/files/LanguageSnippetTests/output/types/thisType1.pcf new file mode 100644 index 000000000..bf870ded0 --- /dev/null +++ b/pkl-core/src/test/files/LanguageSnippetTests/output/types/thisType1.pcf @@ -0,0 +1,11 @@ +result = "ok" +res1a = 1 +res1b = 2 +res1c = 3 +res1d = 2 +res11a = 2 +res11b = 3 +res11c = 4 +res11d = 4 +res12 = "Expected value of type `thisType1#Good`, but got type `thisType1`. Value: new ModuleClass { x = 1; res1 { x = 1; res1 { x = 1; res1 { x = 1; res1 { x =..." +res14a = "Expected value of type `thisType1#Good`, but got type `thisType1`. Value: new ModuleClass { x = 1; res1 { x = 1; res1 { x = 1; res1 { x = 1; res1 { x =..." diff --git a/pkl-core/src/test/files/LanguageSnippetTests/output/types/thisType2.err b/pkl-core/src/test/files/LanguageSnippetTests/output/types/thisType2.err new file mode 100644 index 000000000..dcc376481 --- /dev/null +++ b/pkl-core/src/test/files/LanguageSnippetTests/output/types/thisType2.err @@ -0,0 +1,6 @@ +–– Pkl Error –– +Cannot declare `this` types inside type alias bodies. + +x | typealias Foo = this + ^^^^ +at thisType2#Foo (file:///$snippetsDir/input/types/thisType2.pkl) diff --git a/pkl-core/src/test/files/LanguageSnippetTests/output/types/thisType3.pcf b/pkl-core/src/test/files/LanguageSnippetTests/output/types/thisType3.pcf new file mode 100644 index 000000000..043504165 --- /dev/null +++ b/pkl-core/src/test/files/LanguageSnippetTests/output/types/thisType3.pcf @@ -0,0 +1,15 @@ +res1 = 1 +res2 { + new { + "hello" + } + new { + ["hello"] = "world" + } + new { + res1 = 1 + res2 = "blah" + } + 123 + false +} diff --git a/pkl-core/src/test/files/LanguageSnippetTests/output/types/thisType4.pcf b/pkl-core/src/test/files/LanguageSnippetTests/output/types/thisType4.pcf new file mode 100644 index 000000000..043504165 --- /dev/null +++ b/pkl-core/src/test/files/LanguageSnippetTests/output/types/thisType4.pcf @@ -0,0 +1,15 @@ +res1 = 1 +res2 { + new { + "hello" + } + new { + ["hello"] = "world" + } + new { + res1 = 1 + res2 = "blah" + } + 123 + false +} diff --git a/pkl-core/src/test/files/LanguageSnippetTests/output/types/thisType5.pcf b/pkl-core/src/test/files/LanguageSnippetTests/output/types/thisType5.pcf new file mode 100644 index 000000000..30df5c4ad --- /dev/null +++ b/pkl-core/src/test/files/LanguageSnippetTests/output/types/thisType5.pcf @@ -0,0 +1,13 @@ +res1 { + bar = null + baz = true +} +res2 = true +res3 { + bar { + bar = null + baz = true + } + baz = true +} +res4 = true diff --git a/pkl-doc/src/main/kotlin/org/pkl/doc/PackageDataGenerator.kt b/pkl-doc/src/main/kotlin/org/pkl/doc/PackageDataGenerator.kt index 6fff6c81a..12e9e59c6 100644 --- a/pkl-doc/src/main/kotlin/org/pkl/doc/PackageDataGenerator.kt +++ b/pkl-doc/src/main/kotlin/org/pkl/doc/PackageDataGenerator.kt @@ -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"); * 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 -> {} is PType.Nullable -> { findTypesUsedBy(type.baseType, enclosingType, enclosingPackage, result) diff --git a/pkl-doc/src/main/kotlin/org/pkl/doc/PageGenerator.kt b/pkl-doc/src/main/kotlin/org/pkl/doc/PageGenerator.kt index 1e632eec2..ce7aea921 100644 --- a/pkl-doc/src/main/kotlin/org/pkl/doc/PageGenerator.kt +++ b/pkl-doc/src/main/kotlin/org/pkl/doc/PageGenerator.kt @@ -347,6 +347,9 @@ internal abstract class PageGenerator( PType.MODULE -> { +"module" } + PType.THIS -> { + +"this" + } is PType.StringLiteral -> { +"\"${type.literal}\"" } diff --git a/pkl-doc/src/main/kotlin/org/pkl/doc/SearchIndexGenerator.kt b/pkl-doc/src/main/kotlin/org/pkl/doc/SearchIndexGenerator.kt index 71c4eeb75..514b61ec0 100644 --- a/pkl-doc/src/main/kotlin/org/pkl/doc/SearchIndexGenerator.kt +++ b/pkl-doc/src/main/kotlin/org/pkl/doc/SearchIndexGenerator.kt @@ -343,6 +343,9 @@ internal class SearchIndexGenerator(private val outputDir: Path, consoleOut: Out PType.MODULE -> { append("module") } + PType.THIS -> { + append("this") + } is PType.StringLiteral -> { append("\\\"${type.literal}\\\"") } diff --git a/pkl-formatter/src/main/java/org/pkl/formatter/Builder.java b/pkl-formatter/src/main/java/org/pkl/formatter/Builder.java index 247ee8a04..683a7908d 100644 --- a/pkl-formatter/src/main/java/org/pkl/formatter/Builder.java +++ b/pkl-formatter/src/main/java/org/pkl/formatter/Builder.java @@ -69,6 +69,7 @@ FormatNode format(Node node) { MODULE_EXPR, NULL_EXPR, MODULE_TYPE, + THIS_TYPE, UNKNOWN_TYPE, NOTHING_TYPE, SHEBANG, diff --git a/pkl-parser/src/main/java/org/pkl/parser/BaseParserVisitor.java b/pkl-parser/src/main/java/org/pkl/parser/BaseParserVisitor.java index 8e4a57e85..2b1fbfd6f 100644 --- a/pkl-parser/src/main/java/org/pkl/parser/BaseParserVisitor.java +++ b/pkl-parser/src/main/java/org/pkl/parser/BaseParserVisitor.java @@ -82,6 +82,7 @@ import org.pkl.parser.syntax.Type.NullableType; import org.pkl.parser.syntax.Type.ParenthesizedType; 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.UnknownType; import org.pkl.parser.syntax.TypeAlias; @@ -107,6 +108,11 @@ public T visitModuleType(ModuleType type) { return defaultValue(); } + @Override + public T visitThisType(ThisType type) { + return defaultValue(); + } + @Override public T visitStringConstantType(StringConstantType type) { return visitChildren(type); diff --git a/pkl-parser/src/main/java/org/pkl/parser/GenericParserImpl.java b/pkl-parser/src/main/java/org/pkl/parser/GenericParserImpl.java index 0dd9b9a65..46b6da538 100644 --- a/pkl-parser/src/main/java/org/pkl/parser/GenericParserImpl.java +++ b/pkl-parser/src/main/java/org/pkl/parser/GenericParserImpl.java @@ -1161,6 +1161,7 @@ private Node parseTypeAtom(@Nullable String expectation) { case UNKNOWN -> make(NodeType.UNKNOWN_TYPE, next().span); case NOTHING -> make(NodeType.NOTHING_TYPE, next().span); case MODULE -> make(NodeType.MODULE_TYPE, next().span); + case THIS -> make(NodeType.THIS_TYPE, next().span); case LPAREN -> { var children = new ArrayList(); children.add(makeTerminal(next())); diff --git a/pkl-parser/src/main/java/org/pkl/parser/ParserImpl.java b/pkl-parser/src/main/java/org/pkl/parser/ParserImpl.java index 390396ab5..47636e76f 100644 --- a/pkl-parser/src/main/java/org/pkl/parser/ParserImpl.java +++ b/pkl-parser/src/main/java/org/pkl/parser/ParserImpl.java @@ -1391,6 +1391,7 @@ private Type parseTypeAtom(@Nullable String expectation) { case UNKNOWN -> typ = new Type.UnknownType(next().span); case NOTHING -> typ = new Type.NothingType(next().span); case MODULE -> typ = new Type.ModuleType(next().span); + case THIS -> typ = new Type.ThisType(next().span); case LPAREN -> { var tk = next(); var children = new ArrayList(); diff --git a/pkl-parser/src/main/java/org/pkl/parser/ParserVisitor.java b/pkl-parser/src/main/java/org/pkl/parser/ParserVisitor.java index 4badd687f..d8febb245 100644 --- a/pkl-parser/src/main/java/org/pkl/parser/ParserVisitor.java +++ b/pkl-parser/src/main/java/org/pkl/parser/ParserVisitor.java @@ -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"); * you may not use this file except in compliance with the License. @@ -82,6 +82,8 @@ public interface ParserVisitor { Result visitModuleType(Type.ModuleType type); + Result visitThisType(Type.ThisType type); + Result visitStringConstantType(Type.StringConstantType type); Result visitDeclaredType(Type.DeclaredType type); diff --git a/pkl-parser/src/main/java/org/pkl/parser/syntax/Type.java b/pkl-parser/src/main/java/org/pkl/parser/syntax/Type.java index 88ab013d8..f77688a58 100644 --- a/pkl-parser/src/main/java/org/pkl/parser/syntax/Type.java +++ b/pkl-parser/src/main/java/org/pkl/parser/syntax/Type.java @@ -61,6 +61,17 @@ public T accept(ParserVisitor visitor) { } } + public static final class ThisType extends Type { + public ThisType(Span span) { + super(span, List.of()); + } + + @Override + public T accept(ParserVisitor visitor) { + return visitor.visitThisType(this); + } + } + public static final class StringConstantType extends Type { public StringConstantType(StringConstant str, Span span) { super(span, List.of(str)); diff --git a/pkl-parser/src/main/java/org/pkl/parser/syntax/generic/NodeType.java b/pkl-parser/src/main/java/org/pkl/parser/syntax/generic/NodeType.java index 34d4d1bff..793e5d261 100644 --- a/pkl-parser/src/main/java/org/pkl/parser/syntax/generic/NodeType.java +++ b/pkl-parser/src/main/java/org/pkl/parser/syntax/generic/NodeType.java @@ -135,6 +135,7 @@ public enum NodeType { UNKNOWN_TYPE(NodeKind.TYPE), NOTHING_TYPE(NodeKind.TYPE), MODULE_TYPE(NodeKind.TYPE), + THIS_TYPE(NodeKind.TYPE), UNION_TYPE(NodeKind.TYPE), FUNCTION_TYPE(NodeKind.TYPE), FUNCTION_TYPE_PARAMETERS, diff --git a/pkl-parser/src/test/kotlin/org/pkl/parser/SexpRenderer.kt b/pkl-parser/src/test/kotlin/org/pkl/parser/SexpRenderer.kt index b7b7419bc..076971424 100644 --- a/pkl-parser/src/test/kotlin/org/pkl/parser/SexpRenderer.kt +++ b/pkl-parser/src/test/kotlin/org/pkl/parser/SexpRenderer.kt @@ -773,6 +773,10 @@ class SexpRenderer { buf.append(tab) buf.append("(moduleType)") } + is ThisType -> { + buf.append(tab) + buf.append("(thisType)") + } is StringConstantType -> renderStringConstantType(type) is DeclaredType -> renderDeclaredType(type) is ParenthesizedType -> renderParenthesizedType(type) diff --git a/stdlib/base.pkl b/stdlib/base.pkl index ee3e94ef2..faec77804 100644 --- a/stdlib/base.pkl +++ b/stdlib/base.pkl @@ -46,7 +46,7 @@ import "pkl:yaml" /// ``` abstract external class Any { /// Returns the class of [this]. - external function getClass(): Class + external function getClass(): Class /// Returns a string representation of [this]. /// @@ -57,7 +57,7 @@ abstract external class Any { /// /// This method is the complement of the `??` operator and the equivalent of an `Option` type's /// `map` and `flatMap` methods. - external function ifNonNull(transform: (NonNull) -> Result): Result? + external function ifNonNull(transform: (this) -> Result): Result? } /// The type of [null] and null values created with [Null()]. diff --git a/stdlib/ref.pkl b/stdlib/ref.pkl index 6b0ff66e2..c7f9d0f3c 100644 --- a/stdlib/ref.pkl +++ b/stdlib/ref.pkl @@ -210,7 +210,7 @@ external class Reference { abstract class Domain { /// Determines how [Reference] instances are transformed to strings by [Reference.toString()] and /// string interpolation. - abstract function renderReference(reference: Reference): String + abstract function renderReference(reference: Reference): String } /// A property or subscript access as part of a [Reference]'s path. diff --git a/stdlib/reflect.pkl b/stdlib/reflect.pkl index 1a48b5128..0ec595159 100644 --- a/stdlib/reflect.pkl +++ b/stdlib/reflect.pkl @@ -107,6 +107,9 @@ const bytesType: DeclaredType = DeclaredType(Class(Bytes)) /// A mirror for the `module` type. external const moduleType: ModuleType +/// A mirror for the `this` type. +external const thisType: ThisType + /// A mirror for the `unknown` type. external const unknownType: UnknownType @@ -431,6 +434,11 @@ external class FunctionType extends Type { /// [moduleType] is an instance of this class. class ModuleType extends Type +/// The `this` type. +/// +/// [thisType] is an instance of this class. +class ThisType extends Type + /// The `unknown` type. /// /// [unknownType] is an instance of this class. From 8494e30626fc2e71a1eab79a323768c644abaeec Mon Sep 17 00:00:00 2001 From: Jen Basch Date: Thu, 23 Jul 2026 18:09:45 -0700 Subject: [PATCH 2/3] Regen pkl-doc test output --- .../org/pkl/core/ast/builder/AstBuilder.java | 48 ++++++++++++++----- .../org/pkl/core/ast/builder/SymbolTable.java | 8 ++++ .../org/pkl/core/errorMessages.properties | 15 ++++++ .../input/types/currentModuleType4.pkl | 8 ++++ .../output/types/currentModuleType4.err | 8 +++- .../1.2.3/Module Containing Spaces/index.html | 2 +- .../1.2.3/baseModule/BaseClass.html | 2 +- .../com.package1/1.2.3/baseModule/index.html | 2 +- .../classAnnotations/AnnotatedClass.html | 2 +- .../1.2.3/classAnnotations/AnnotatedClss.html | 2 +- .../AnnotatedClssWithExpandableComment.html | 2 +- .../1.2.3/classAnnotations/index.html | 2 +- .../1.2.3/classComments/Comments1.html | 2 +- .../1.2.3/classComments/Comments2.html | 2 +- .../1.2.3/classComments/Comments3.html | 2 +- .../1.2.3/classComments/Comments4.html | 2 +- .../1.2.3/classComments/Comments5.html | 2 +- .../1.2.3/classComments/Comments6.html | 2 +- .../1.2.3/classComments/Comments7.html | 2 +- .../1.2.3/classComments/Comments8.html | 2 +- .../1.2.3/classComments/index.html | 2 +- .../1.2.3/classInheritance/MyClass1.html | 2 +- .../1.2.3/classInheritance/MyClass2.html | 2 +- .../1.2.3/classInheritance/MyClass3.html | 2 +- .../1.2.3/classInheritance/MyClass4.html | 2 +- .../1.2.3/classInheritance/index.html | 2 +- .../1.2.3/classMethodComments/Comments.html | 2 +- .../1.2.3/classMethodComments/index.html | 2 +- .../1.2.3/classMethodModifiers/Modifiers.html | 2 +- .../1.2.3/classMethodModifiers/index.html | 2 +- .../TypeAnnotations.html | 2 +- .../classMethodTypeAnnotations/index.html | 2 +- .../classMethodTypeReferences/MyClass.html | 2 +- .../TypeReferences.html | 2 +- .../classMethodTypeReferences/index.html | 2 +- .../ClassWithAnnotatedProperty.html | 2 +- .../UserDefinedAnnotation.html | 2 +- .../1.2.3/classPropertyAnnotations/index.html | 2 +- .../1.2.3/classPropertyComments/Comments.html | 2 +- .../1.2.3/classPropertyComments/index.html | 2 +- .../classPropertyModifiers/Modifiers.html | 2 +- .../1.2.3/classPropertyModifiers/index.html | 2 +- .../TypeAnnotations.html | 2 +- .../classPropertyTypeAnnotations/index.html | 2 +- .../classPropertyTypeReferences/MyClass.html | 2 +- .../TypeReferences.html | 2 +- .../classPropertyTypeReferences/index.html | 2 +- .../1.2.3/classTypeConstraints/Address.html | 2 +- .../1.2.3/classTypeConstraints/Person1.html | 2 +- .../1.2.3/classTypeConstraints/Person2.html | 2 +- .../1.2.3/classTypeConstraints/Project.html | 2 +- .../1.2.3/classTypeConstraints/index.html | 2 +- .../1.2.3/docExampleSubject1/index.html | 2 +- .../1.2.3/docExampleSubject2/index.html | 2 +- .../com.package1/1.2.3/docLinks/Person.html | 2 +- .../com.package1/1.2.3/docLinks/index.html | 2 +- .../1.2.3/methodAnnotations/index.html | 2 +- .../1.2.3/moduleComments/index.html | 2 +- .../1.2.3/moduleExtend/ExtendClass.html | 2 +- .../1.2.3/moduleExtend/index.html | 2 +- .../1.2.3/moduleInfoAnnotation/index.html | 2 +- .../moduleMethodCommentInheritance/index.html | 2 +- .../1.2.3/moduleMethodComments/index.html | 2 +- .../1.2.3/moduleMethodModifiers/index.html | 2 +- .../moduleMethodTypeAnnotations/index.html | 2 +- .../moduleMethodTypeReferences/MyClass.html | 2 +- .../moduleMethodTypeReferences/index.html | 2 +- .../UserDefinedAnnotation.html | 2 +- .../UserDefinedAnnotation1.html | 2 +- .../UserDefinedAnnotation2.html | 2 +- .../modulePropertyAnnotations/index.html | 2 +- .../index.html | 2 +- .../1.2.3/modulePropertyComments/index.html | 2 +- .../1.2.3/modulePropertyModifiers/index.html | 2 +- .../modulePropertyTypeAnnotations/index.html | 2 +- .../modulePropertyTypeReferences/MyClass.html | 2 +- .../modulePropertyTypeReferences/index.html | 2 +- .../1.2.3/moduleTypes1/index.html | 2 +- .../com.package1/1.2.3/moduleTypes2/Foo.html | 2 +- .../1.2.3/moduleTypes2/index.html | 2 +- .../nested/nested2/nestedModule/MyClass.html | 2 +- .../nested/nested2/nestedModule/index.html | 2 +- .../com.package1/1.2.3/shared/MyClass.html | 2 +- .../com.package1/1.2.3/shared/index.html | 2 +- .../1.2.3/ternalPackage/index.html | 2 +- .../1.2.3/typeAliasInheritance/Person2.html | 2 +- .../1.2.3/typeAliasInheritance/index.html | 2 +- .../1.2.3/typealiases/Person.html | 2 +- .../com.package1/1.2.3/typealiases/index.html | 2 +- .../com.package1/1.2.3/typealiases2/Foo.html | 2 +- .../1.2.3/typealiases2/Person.html | 2 +- .../1.2.3/typealiases2/index.html | 2 +- .../com.package1/1.2.3/unionTypes/index.html | 2 +- .../1.2.3/unlistedClass/index.html | 2 +- .../1.2.3/unlistedMethod/MyClass.html | 2 +- .../1.2.3/unlistedMethod/index.html | 2 +- .../1.2.3/unlistedProperty/MyClass.html | 2 +- .../1.2.3/unlistedProperty/index.html | 2 +- .../4.5.6/Module3/Class Two {}.html | 2 +- .../com.package2/4.5.6/Module3/Class3.html | 2 +- .../com.package2/4.5.6/Module3/index.html | 2 +- .../birds/0.5.0/Bird/index.html | 2 +- .../birds/0.5.0/allFruit/index.html | 2 +- .../birds/0.5.0/catalog/index.html | 2 +- .../deprecated/1.0.0/deprecated/index.html | 2 +- .../fruit/1.1.0/Fruit/index.html | 2 +- .../1.2.3/Module Containing Spaces/index.html | 2 +- .../1.2.3/baseModule/BaseClass.html | 2 +- .../com.package1/1.2.3/baseModule/index.html | 2 +- .../classAnnotations/AnnotatedClass.html | 2 +- .../1.2.3/classAnnotations/AnnotatedClss.html | 2 +- .../AnnotatedClssWithExpandableComment.html | 2 +- .../1.2.3/classAnnotations/index.html | 2 +- .../1.2.3/classComments/Comments1.html | 2 +- .../1.2.3/classComments/Comments2.html | 2 +- .../1.2.3/classComments/Comments3.html | 2 +- .../1.2.3/classComments/Comments4.html | 2 +- .../1.2.3/classComments/Comments5.html | 2 +- .../1.2.3/classComments/Comments6.html | 2 +- .../1.2.3/classComments/Comments7.html | 2 +- .../1.2.3/classComments/Comments8.html | 2 +- .../1.2.3/classComments/index.html | 2 +- .../1.2.3/classInheritance/MyClass1.html | 2 +- .../1.2.3/classInheritance/MyClass2.html | 2 +- .../1.2.3/classInheritance/MyClass3.html | 2 +- .../1.2.3/classInheritance/MyClass4.html | 2 +- .../1.2.3/classInheritance/index.html | 2 +- .../1.2.3/classMethodComments/Comments.html | 2 +- .../1.2.3/classMethodComments/index.html | 2 +- .../1.2.3/classMethodModifiers/Modifiers.html | 2 +- .../1.2.3/classMethodModifiers/index.html | 2 +- .../TypeAnnotations.html | 2 +- .../classMethodTypeAnnotations/index.html | 2 +- .../classMethodTypeReferences/MyClass.html | 2 +- .../TypeReferences.html | 2 +- .../classMethodTypeReferences/index.html | 2 +- .../ClassWithAnnotatedProperty.html | 2 +- .../UserDefinedAnnotation.html | 2 +- .../1.2.3/classPropertyAnnotations/index.html | 2 +- .../1.2.3/classPropertyComments/Comments.html | 2 +- .../1.2.3/classPropertyComments/index.html | 2 +- .../classPropertyModifiers/Modifiers.html | 2 +- .../1.2.3/classPropertyModifiers/index.html | 2 +- .../TypeAnnotations.html | 2 +- .../classPropertyTypeAnnotations/index.html | 2 +- .../classPropertyTypeReferences/MyClass.html | 2 +- .../TypeReferences.html | 2 +- .../classPropertyTypeReferences/index.html | 2 +- .../1.2.3/classTypeConstraints/Address.html | 2 +- .../1.2.3/classTypeConstraints/Person1.html | 2 +- .../1.2.3/classTypeConstraints/Person2.html | 2 +- .../1.2.3/classTypeConstraints/Project.html | 2 +- .../1.2.3/classTypeConstraints/index.html | 2 +- .../1.2.3/docExampleSubject1/index.html | 2 +- .../1.2.3/docExampleSubject2/index.html | 2 +- .../com.package1/1.2.3/docLinks/Person.html | 2 +- .../com.package1/1.2.3/docLinks/index.html | 2 +- .../1.2.3/methodAnnotations/index.html | 2 +- .../1.2.3/moduleComments/index.html | 2 +- .../1.2.3/moduleExtend/ExtendClass.html | 2 +- .../1.2.3/moduleExtend/index.html | 2 +- .../1.2.3/moduleInfoAnnotation/index.html | 2 +- .../moduleMethodCommentInheritance/index.html | 2 +- .../1.2.3/moduleMethodComments/index.html | 2 +- .../1.2.3/moduleMethodModifiers/index.html | 2 +- .../moduleMethodTypeAnnotations/index.html | 2 +- .../moduleMethodTypeReferences/MyClass.html | 2 +- .../moduleMethodTypeReferences/index.html | 2 +- .../UserDefinedAnnotation.html | 2 +- .../UserDefinedAnnotation1.html | 2 +- .../UserDefinedAnnotation2.html | 2 +- .../modulePropertyAnnotations/index.html | 2 +- .../index.html | 2 +- .../1.2.3/modulePropertyComments/index.html | 2 +- .../1.2.3/modulePropertyModifiers/index.html | 2 +- .../modulePropertyTypeAnnotations/index.html | 2 +- .../modulePropertyTypeReferences/MyClass.html | 2 +- .../modulePropertyTypeReferences/index.html | 2 +- .../1.2.3/moduleTypes1/index.html | 2 +- .../com.package1/1.2.3/moduleTypes2/Foo.html | 2 +- .../1.2.3/moduleTypes2/index.html | 2 +- .../nested/nested2/nestedModule/MyClass.html | 2 +- .../nested/nested2/nestedModule/index.html | 2 +- .../com.package1/1.2.3/shared/MyClass.html | 2 +- .../com.package1/1.2.3/shared/index.html | 2 +- .../1.2.3/ternalPackage/index.html | 2 +- .../1.2.3/typeAliasInheritance/Person2.html | 2 +- .../1.2.3/typeAliasInheritance/index.html | 2 +- .../1.2.3/typealiases/Person.html | 2 +- .../com.package1/1.2.3/typealiases/index.html | 2 +- .../com.package1/1.2.3/typealiases2/Foo.html | 2 +- .../1.2.3/typealiases2/Person.html | 2 +- .../1.2.3/typealiases2/index.html | 2 +- .../com.package1/1.2.3/unionTypes/index.html | 2 +- .../1.2.3/unlistedClass/index.html | 2 +- .../1.2.3/unlistedMethod/MyClass.html | 2 +- .../1.2.3/unlistedMethod/index.html | 2 +- .../1.2.3/unlistedProperty/MyClass.html | 2 +- .../1.2.3/unlistedProperty/index.html | 2 +- .../4.5.6/Module3/Class Two {}.html | 2 +- .../com.package2/4.5.6/Module3/Class3.html | 2 +- .../com.package2/4.5.6/Module3/index.html | 2 +- .../birds/0.5.0/Bird/index.html | 2 +- .../birds/0.5.0/allFruit/index.html | 2 +- .../birds/0.5.0/catalog/index.html | 2 +- .../birds/0.6.0/Bird/index.html | 2 +- .../birds/0.6.0/allFruit/index.html | 2 +- .../birds/0.6.0/catalog/index.html | 2 +- .../birds/0.7.0/Bird/index.html | 2 +- .../birds/0.7.0/allFruit/index.html | 2 +- .../birds/0.7.0/catalog/index.html | 2 +- .../deprecated/1.0.0/deprecated/index.html | 2 +- .../fruit/1.1.0/Fruit/index.html | 2 +- .../com.package1/1.2.3/minimal/Person.html | 2 +- .../com.package1/1.2.3/minimal/index.html | 2 +- .../com.package1/4.5.6/minimal/Person.html | 2 +- .../com.package1/4.5.6/minimal/index.html | 2 +- .../com.package1/current/minimal/Person.html | 2 +- .../com.package1/current/minimal/index.html | 2 +- 219 files changed, 286 insertions(+), 229 deletions(-) diff --git a/pkl-core/src/main/java/org/pkl/core/ast/builder/AstBuilder.java b/pkl-core/src/main/java/org/pkl/core/ast/builder/AstBuilder.java index b444320a2..5aba56d21 100644 --- a/pkl-core/src/main/java/org/pkl/core/ast/builder/AstBuilder.java +++ b/pkl-core/src/main/java/org/pkl/core/ast/builder/AstBuilder.java @@ -382,21 +382,43 @@ public UnresolvedTypeNode visitNothingType(NothingType type) { @Override public UnresolvedTypeNode visitModuleType(ModuleType type) { var sourceSection = createSourceSection(type); - for (var scope = symbolTable.getCurrentScope(); scope != null; scope = scope.getParent()) { - if (scope.isAnnotationScope()) break; - if (scope instanceof ClassScope classScope && classScope.getSuperClass() != type) { - logger.warn( - ErrorMessages.create("invalidSelfTypeUsage", "module", "class") - + " This will be an error in a future release.", - VmUtils.createStackFrame(sourceSection, null)); - break; + String errorMessage = null; + Object[] errorArgs = new Object[] {}; + + // attempt to identify containing class/alias/annotation before checking const + // properties/methods + for (var scope = symbolTable.getCurrentScope(); + scope != null && errorMessage == null; + scope = scope.getParent()) { + if (scope.isAnnotationScope()) { + errorMessage = "moduleTypeIsNotConstAnnotation"; + } else if (scope.isClassScope()) { + errorMessage = "moduleTypeIsNotConstClass"; } else if (scope.isTypeAliasScope()) { - logger.warn( - ErrorMessages.create("invalidSelfTypeUsage", "module", "type alias") - + " This will be an error in a future release.", - VmUtils.createStackFrame(sourceSection, null)); - break; + errorMessage = "moduleTypeIsNotConstTypeAlias"; + } + } + for (var scope = symbolTable.getCurrentScope(); + scope != null && errorMessage == null; + scope = scope.getParent()) { + if (!scope.getConstLevel().isConst()) { + continue; } + if (scope.isPropertyScope()) { + errorMessage = "moduleTypeIsNotConstProperty"; + errorArgs = new Object[] {scope.getQualifiedName()}; + } else if (scope.isMethodScope()) { + errorMessage = "moduleTypeIsNotConstMethod"; + errorArgs = new Object[] {scope.getQualifiedName()}; + } else { + throw exceptionBuilder().unreachableCode().build(); + } + } + if (errorMessage != null) { + logger.warn( + ErrorMessages.create(errorMessage, errorArgs) + + " This will be an error in a future release.", + VmUtils.createStackFrame(sourceSection, null)); } return new UnresolvedTypeNode.Module(sourceSection); diff --git a/pkl-core/src/main/java/org/pkl/core/ast/builder/SymbolTable.java b/pkl-core/src/main/java/org/pkl/core/ast/builder/SymbolTable.java index 5f0c4e066..021ca60d6 100644 --- a/pkl-core/src/main/java/org/pkl/core/ast/builder/SymbolTable.java +++ b/pkl-core/src/main/java/org/pkl/core/ast/builder/SymbolTable.java @@ -417,6 +417,14 @@ 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() { return this instanceof LetExpressionScope; } diff --git a/pkl-core/src/main/resources/org/pkl/core/errorMessages.properties b/pkl-core/src/main/resources/org/pkl/core/errorMessages.properties index 1c45d8a43..3885589b4 100644 --- a/pkl-core/src/main/resources/org/pkl/core/errorMessages.properties +++ b/pkl-core/src/main/resources/org/pkl/core/errorMessages.properties @@ -259,6 +259,21 @@ Cannot reference `module` within a class body. moduleIsNotConstAnnotation=\ Cannot reference `module` within an annotation body. +moduleTypeIsNotConstProperty=\ +Cannot reference `module` type from const property `{0}`. + +moduleTypeIsNotConstMethod=\ +Cannot reference `module` type from const method `{0}`. + +moduleTypeIsNotConstClass=\ +Cannot reference `module` type within a class body. + +moduleTypeIsNotConstAnnotation=\ +Cannot reference `module` type within an annotation body. + +moduleTypeIsNotConstTypeAlias=\ +Cannot reference `module` type within an annotation body. + outerIsNotConst=\ Cannot reference `outer` from here because it's not `const`. diff --git a/pkl-core/src/test/files/LanguageSnippetTests/input/types/currentModuleType4.pkl b/pkl-core/src/test/files/LanguageSnippetTests/input/types/currentModuleType4.pkl index 886404c8d..def8514c8 100644 --- a/pkl-core/src/test/files/LanguageSnippetTests/input/types/currentModuleType4.pkl +++ b/pkl-core/src/test/files/LanguageSnippetTests/input/types/currentModuleType4.pkl @@ -1,5 +1,13 @@ 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 diff --git a/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType4.err b/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType4.err index d3a798bef..83ac9dd01 100644 --- a/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType4.err +++ b/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType4.err @@ -1,2 +1,6 @@ -pkl: WARN: Cannot declare `module` types inside class bodies. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType4.pkl) -pkl: WARN: Cannot declare `module` types inside type alias bodies. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType4.pkl) +qux = 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 an annotation 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 method `currentModuleType4#quux`. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType4.pkl) diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/Module Containing Spaces/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/Module Containing Spaces/index.html index 38a5fcc8f..65fe64c72 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/Module Containing Spaces/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/Module Containing Spaces/index.html @@ -105,7 +105,7 @@

Methods(function
- +
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/baseModule/BaseClass.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/baseModule/BaseClass.html index ddb2f5424..d366d30ca 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/baseModule/BaseClass.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/baseModule/BaseClass.html @@ -79,7 +79,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/baseModule/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/baseModule/index.html index b1a220930..1b12b03dc 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/baseModule/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/baseModule/index.html @@ -116,7 +116,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classAnnotations/AnnotatedClass.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classAnnotations/AnnotatedClass.html index 084024b0f..8146b55dd 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classAnnotations/AnnotatedClass.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classAnnotations/AnnotatedClass.html @@ -82,7 +82,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classAnnotations/AnnotatedClss.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classAnnotations/AnnotatedClss.html index ded131e97..9a760ffa0 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classAnnotations/AnnotatedClss.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classAnnotations/AnnotatedClss.html @@ -84,7 +84,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classAnnotations/AnnotatedClssWithExpandableComment.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classAnnotations/AnnotatedClssWithExpandableComment.html index 40baa3c9e..4667fbeb0 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classAnnotations/AnnotatedClssWithExpandableComment.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classAnnotations/AnnotatedClssWithExpandableComment.html @@ -84,7 +84,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classAnnotations/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classAnnotations/index.html index a3ede57bb..8d0c26328 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classAnnotations/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classAnnotations/index.html @@ -105,7 +105,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classComments/Comments1.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classComments/Comments1.html index 3fd66de13..bb316f9e8 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classComments/Comments1.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classComments/Comments1.html @@ -79,7 +79,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classComments/Comments2.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classComments/Comments2.html index 7251e67e6..638726ec3 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classComments/Comments2.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classComments/Comments2.html @@ -79,7 +79,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classComments/Comments3.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classComments/Comments3.html index cbdd47863..9fcc55488 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classComments/Comments3.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classComments/Comments3.html @@ -80,7 +80,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classComments/Comments4.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classComments/Comments4.html index 6811e2f6d..fed626c9b 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classComments/Comments4.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classComments/Comments4.html @@ -84,7 +84,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classComments/Comments5.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classComments/Comments5.html index 47e1e53c9..497083912 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classComments/Comments5.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classComments/Comments5.html @@ -80,7 +80,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classComments/Comments6.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classComments/Comments6.html index 0445ff447..909eb953e 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classComments/Comments6.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classComments/Comments6.html @@ -82,7 +82,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classComments/Comments7.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classComments/Comments7.html index 5184fba22..f7b4e48ee 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classComments/Comments7.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classComments/Comments7.html @@ -80,7 +80,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classComments/Comments8.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classComments/Comments8.html index 2f5d6936c..c95141ccb 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classComments/Comments8.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classComments/Comments8.html @@ -131,7 +131,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classComments/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classComments/index.html index 81791d7e5..b9d49ddd6 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classComments/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classComments/index.html @@ -175,7 +175,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classInheritance/MyClass1.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classInheritance/MyClass1.html index 7c4d757ad..efd1ed440 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classInheritance/MyClass1.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classInheritance/MyClass1.html @@ -98,7 +98,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classInheritance/MyClass2.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classInheritance/MyClass2.html index 0070cc5b2..7441d300a 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classInheritance/MyClass2.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classInheritance/MyClass2.html @@ -109,7 +109,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classInheritance/MyClass3.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classInheritance/MyClass3.html index 3c0b294a3..e0fd03373 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classInheritance/MyClass3.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classInheritance/MyClass3.html @@ -109,7 +109,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classInheritance/MyClass4.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classInheritance/MyClass4.html index 487022eec..f9e3b2d10 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classInheritance/MyClass4.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classInheritance/MyClass4.html @@ -120,7 +120,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classInheritance/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classInheritance/index.html index aa47831e7..f13df8520 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classInheritance/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classInheritance/index.html @@ -106,7 +106,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classMethodComments/Comments.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classMethodComments/Comments.html index a7968c272..7d5f559f9 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classMethodComments/Comments.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classMethodComments/Comments.html @@ -79,7 +79,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classMethodComments/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classMethodComments/index.html index 9802bf478..2083b2d20 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classMethodComments/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classMethodComments/index.html @@ -106,7 +106,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classMethodModifiers/Modifiers.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classMethodModifiers/Modifiers.html index fad4c9c1a..6580a8880 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classMethodModifiers/Modifiers.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classMethodModifiers/Modifiers.html @@ -79,7 +79,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classMethodModifiers/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classMethodModifiers/index.html index f74558369..de7d2cf52 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classMethodModifiers/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classMethodModifiers/index.html @@ -106,7 +106,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classMethodTypeAnnotations/TypeAnnotations.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classMethodTypeAnnotations/TypeAnnotations.html index 4f504e525..67a3d4ac3 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classMethodTypeAnnotations/TypeAnnotations.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classMethodTypeAnnotations/TypeAnnotations.html @@ -79,7 +79,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classMethodTypeAnnotations/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classMethodTypeAnnotations/index.html index 50ad8e81d..ccb54de71 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classMethodTypeAnnotations/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classMethodTypeAnnotations/index.html @@ -106,7 +106,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classMethodTypeReferences/MyClass.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classMethodTypeReferences/MyClass.html index 01b9b698c..3b5e9964a 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classMethodTypeReferences/MyClass.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classMethodTypeReferences/MyClass.html @@ -79,7 +79,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classMethodTypeReferences/TypeReferences.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classMethodTypeReferences/TypeReferences.html index ccb964fa8..9701f2f05 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classMethodTypeReferences/TypeReferences.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classMethodTypeReferences/TypeReferences.html @@ -79,7 +79,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classMethodTypeReferences/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classMethodTypeReferences/index.html index 642f29bea..ba9a5de84 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classMethodTypeReferences/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classMethodTypeReferences/index.html @@ -107,7 +107,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classPropertyAnnotations/ClassWithAnnotatedProperty.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classPropertyAnnotations/ClassWithAnnotatedProperty.html index 612bfb053..12c158bf2 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classPropertyAnnotations/ClassWithAnnotatedProperty.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classPropertyAnnotations/ClassWithAnnotatedProperty.html @@ -97,7 +97,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classPropertyAnnotations/UserDefinedAnnotation.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classPropertyAnnotations/UserDefinedAnnotation.html index 8eea5a54e..f35d588b8 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classPropertyAnnotations/UserDefinedAnnotation.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classPropertyAnnotations/UserDefinedAnnotation.html @@ -108,7 +108,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classPropertyAnnotations/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classPropertyAnnotations/index.html index 416e8a3db..0b725ac37 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classPropertyAnnotations/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classPropertyAnnotations/index.html @@ -105,7 +105,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classPropertyComments/Comments.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classPropertyComments/Comments.html index a60749d1c..4deebe067 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classPropertyComments/Comments.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classPropertyComments/Comments.html @@ -172,7 +172,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classPropertyComments/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classPropertyComments/index.html index 06a1af20d..e5ed063f0 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classPropertyComments/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classPropertyComments/index.html @@ -106,7 +106,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classPropertyModifiers/Modifiers.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classPropertyModifiers/Modifiers.html index 3edc2e14a..ee7b01eb7 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classPropertyModifiers/Modifiers.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classPropertyModifiers/Modifiers.html @@ -110,7 +110,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classPropertyModifiers/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classPropertyModifiers/index.html index 7e9bc2a47..225682643 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classPropertyModifiers/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classPropertyModifiers/index.html @@ -106,7 +106,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classPropertyTypeAnnotations/TypeAnnotations.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classPropertyTypeAnnotations/TypeAnnotations.html index 351f800d6..04e5504db 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classPropertyTypeAnnotations/TypeAnnotations.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classPropertyTypeAnnotations/TypeAnnotations.html @@ -206,7 +206,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classPropertyTypeAnnotations/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classPropertyTypeAnnotations/index.html index 75963961c..d78db8874 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classPropertyTypeAnnotations/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classPropertyTypeAnnotations/index.html @@ -106,7 +106,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classPropertyTypeReferences/MyClass.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classPropertyTypeReferences/MyClass.html index 6f7336638..b1032e6e4 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classPropertyTypeReferences/MyClass.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classPropertyTypeReferences/MyClass.html @@ -79,7 +79,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classPropertyTypeReferences/TypeReferences.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classPropertyTypeReferences/TypeReferences.html index 6738f8a70..fd479a2e5 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classPropertyTypeReferences/TypeReferences.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classPropertyTypeReferences/TypeReferences.html @@ -194,7 +194,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classPropertyTypeReferences/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classPropertyTypeReferences/index.html index e757f293c..6eb796be2 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classPropertyTypeReferences/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classPropertyTypeReferences/index.html @@ -107,7 +107,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classTypeConstraints/Address.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classTypeConstraints/Address.html index 8498c3fb2..97021a64d 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classTypeConstraints/Address.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classTypeConstraints/Address.html @@ -108,7 +108,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classTypeConstraints/Person1.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classTypeConstraints/Person1.html index a28041804..acda81518 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classTypeConstraints/Person1.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classTypeConstraints/Person1.html @@ -108,7 +108,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classTypeConstraints/Person2.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classTypeConstraints/Person2.html index 87f4b6b17..5a089f54f 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classTypeConstraints/Person2.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classTypeConstraints/Person2.html @@ -97,7 +97,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classTypeConstraints/Project.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classTypeConstraints/Project.html index 3fa13b668..c347a8274 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classTypeConstraints/Project.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classTypeConstraints/Project.html @@ -108,7 +108,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classTypeConstraints/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classTypeConstraints/index.html index 94c9f4cfb..41263558d 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classTypeConstraints/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/classTypeConstraints/index.html @@ -116,7 +116,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/docExampleSubject1/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/docExampleSubject1/index.html index 0bbbbc075..63c3b3925 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/docExampleSubject1/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/docExampleSubject1/index.html @@ -117,7 +117,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/docExampleSubject2/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/docExampleSubject2/index.html index e4e622d03..2c1cb5a72 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/docExampleSubject2/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/docExampleSubject2/index.html @@ -117,7 +117,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/docLinks/Person.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/docLinks/Person.html index 00696b31e..97c6c15d8 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/docLinks/Person.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/docLinks/Person.html @@ -116,7 +116,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/docLinks/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/docLinks/index.html index 3a061c53c..4a590d8fd 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/docLinks/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/docLinks/index.html @@ -135,7 +135,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/methodAnnotations/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/methodAnnotations/index.html index 834311fdb..38c3bacfb 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/methodAnnotations/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/methodAnnotations/index.html @@ -104,7 +104,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/moduleComments/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/moduleComments/index.html index 24f298bde..67cfe94b4 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/moduleComments/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/moduleComments/index.html @@ -156,7 +156,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/moduleExtend/ExtendClass.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/moduleExtend/ExtendClass.html index 781c74702..f4fb6a91a 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/moduleExtend/ExtendClass.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/moduleExtend/ExtendClass.html @@ -79,7 +79,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/moduleExtend/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/moduleExtend/index.html index 051796cca..7d8de1cb2 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/moduleExtend/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/moduleExtend/index.html @@ -127,7 +127,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/moduleInfoAnnotation/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/moduleInfoAnnotation/index.html index 96d2e0f3f..a7c5fda17 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/moduleInfoAnnotation/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/moduleInfoAnnotation/index.html @@ -106,7 +106,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/moduleMethodCommentInheritance/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/moduleMethodCommentInheritance/index.html index 1af9eee40..c73cfdd21 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/moduleMethodCommentInheritance/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/moduleMethodCommentInheritance/index.html @@ -104,7 +104,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/moduleMethodComments/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/moduleMethodComments/index.html index 0fdd243a1..e0b44364a 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/moduleMethodComments/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/moduleMethodComments/index.html @@ -105,7 +105,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/moduleMethodModifiers/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/moduleMethodModifiers/index.html index 06c96ad88..edd77d032 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/moduleMethodModifiers/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/moduleMethodModifiers/index.html @@ -105,7 +105,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/moduleMethodTypeAnnotations/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/moduleMethodTypeAnnotations/index.html index b1bc4c076..3fe42386b 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/moduleMethodTypeAnnotations/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/moduleMethodTypeAnnotations/index.html @@ -105,7 +105,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/moduleMethodTypeReferences/MyClass.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/moduleMethodTypeReferences/MyClass.html index e0a019a52..64e8d5f90 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/moduleMethodTypeReferences/MyClass.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/moduleMethodTypeReferences/MyClass.html @@ -79,7 +79,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/moduleMethodTypeReferences/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/moduleMethodTypeReferences/index.html index 939ebf739..ca3b8e42d 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/moduleMethodTypeReferences/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/moduleMethodTypeReferences/index.html @@ -107,7 +107,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/modulePropertyAnnotations/UserDefinedAnnotation.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/modulePropertyAnnotations/UserDefinedAnnotation.html index 993894f49..3fc3dc67d 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/modulePropertyAnnotations/UserDefinedAnnotation.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/modulePropertyAnnotations/UserDefinedAnnotation.html @@ -108,7 +108,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/modulePropertyAnnotations/UserDefinedAnnotation1.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/modulePropertyAnnotations/UserDefinedAnnotation1.html index a13e63fb8..73ef7a1f5 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/modulePropertyAnnotations/UserDefinedAnnotation1.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/modulePropertyAnnotations/UserDefinedAnnotation1.html @@ -97,7 +97,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/modulePropertyAnnotations/UserDefinedAnnotation2.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/modulePropertyAnnotations/UserDefinedAnnotation2.html index e1b717574..aab56d91d 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/modulePropertyAnnotations/UserDefinedAnnotation2.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/modulePropertyAnnotations/UserDefinedAnnotation2.html @@ -97,7 +97,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/modulePropertyAnnotations/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/modulePropertyAnnotations/index.html index fd448c89a..3ad25ef8e 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/modulePropertyAnnotations/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/modulePropertyAnnotations/index.html @@ -187,7 +187,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/modulePropertyCommentInheritance/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/modulePropertyCommentInheritance/index.html index fb6fcbc08..dc1811232 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/modulePropertyCommentInheritance/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/modulePropertyCommentInheritance/index.html @@ -237,7 +237,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/modulePropertyComments/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/modulePropertyComments/index.html index 5ae1d42b2..350d76376 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/modulePropertyComments/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/modulePropertyComments/index.html @@ -238,7 +238,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/modulePropertyModifiers/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/modulePropertyModifiers/index.html index 91622fcdb..ea80ad163 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/modulePropertyModifiers/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/modulePropertyModifiers/index.html @@ -117,7 +117,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/modulePropertyTypeAnnotations/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/modulePropertyTypeAnnotations/index.html index d4a128e4a..88a8a946d 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/modulePropertyTypeAnnotations/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/modulePropertyTypeAnnotations/index.html @@ -225,7 +225,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/modulePropertyTypeReferences/MyClass.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/modulePropertyTypeReferences/MyClass.html index 1de8cc07c..d9ca39957 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/modulePropertyTypeReferences/MyClass.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/modulePropertyTypeReferences/MyClass.html @@ -79,7 +79,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/modulePropertyTypeReferences/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/modulePropertyTypeReferences/index.html index 5f4cad3a2..f27573ecf 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/modulePropertyTypeReferences/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/modulePropertyTypeReferences/index.html @@ -215,7 +215,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/moduleTypes1/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/moduleTypes1/index.html index 76233af02..1f137964e 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/moduleTypes1/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/moduleTypes1/index.html @@ -115,7 +115,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/moduleTypes2/Foo.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/moduleTypes2/Foo.html index e6e4735ce..51ed5148b 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/moduleTypes2/Foo.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/moduleTypes2/Foo.html @@ -174,7 +174,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/moduleTypes2/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/moduleTypes2/index.html index 76bfbe855..9697baf3e 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/moduleTypes2/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/moduleTypes2/index.html @@ -193,7 +193,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/nested/nested2/nestedModule/MyClass.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/nested/nested2/nestedModule/MyClass.html index 0d7b9a592..ff00e6bc3 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/nested/nested2/nestedModule/MyClass.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/nested/nested2/nestedModule/MyClass.html @@ -79,7 +79,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/nested/nested2/nestedModule/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/nested/nested2/nestedModule/index.html index 322980f86..45fe361a2 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/nested/nested2/nestedModule/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/nested/nested2/nestedModule/index.html @@ -116,7 +116,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/shared/MyClass.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/shared/MyClass.html index 031f92a6a..28d24ac03 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/shared/MyClass.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/shared/MyClass.html @@ -79,7 +79,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/shared/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/shared/index.html index 190d3585a..3fed58db5 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/shared/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/shared/index.html @@ -105,7 +105,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/ternalPackage/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/ternalPackage/index.html index 57dc9fb07..69d25af27 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/ternalPackage/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/ternalPackage/index.html @@ -116,7 +116,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/typeAliasInheritance/Person2.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/typeAliasInheritance/Person2.html index 09ead29e3..b03263ca0 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/typeAliasInheritance/Person2.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/typeAliasInheritance/Person2.html @@ -153,7 +153,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/typeAliasInheritance/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/typeAliasInheritance/index.html index 1653952d6..16d514625 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/typeAliasInheritance/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/typeAliasInheritance/index.html @@ -173,7 +173,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/typealiases/Person.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/typealiases/Person.html index d2c348a59..0f113aa6c 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/typealiases/Person.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/typealiases/Person.html @@ -131,7 +131,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/typealiases/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/typealiases/index.html index f40e98f62..e5a2a5da9 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/typealiases/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/typealiases/index.html @@ -151,7 +151,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/typealiases2/Foo.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/typealiases2/Foo.html index a73865abc..015094365 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/typealiases2/Foo.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/typealiases2/Foo.html @@ -185,7 +185,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/typealiases2/Person.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/typealiases2/Person.html index cdb428f7a..b904ad650 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/typealiases2/Person.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/typealiases2/Person.html @@ -97,7 +97,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/typealiases2/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/typealiases2/index.html index e4340119b..299d9d42e 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/typealiases2/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/typealiases2/index.html @@ -205,7 +205,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/unionTypes/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/unionTypes/index.html index 6229ded88..fb6b811db 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/unionTypes/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/unionTypes/index.html @@ -170,7 +170,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/unlistedClass/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/unlistedClass/index.html index 1e54c731b..40b97f982 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/unlistedClass/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/unlistedClass/index.html @@ -115,7 +115,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/unlistedMethod/MyClass.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/unlistedMethod/MyClass.html index e84026206..a9570e13e 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/unlistedMethod/MyClass.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/unlistedMethod/MyClass.html @@ -79,7 +79,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/unlistedMethod/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/unlistedMethod/index.html index ec46e8552..058aa0848 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/unlistedMethod/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/unlistedMethod/index.html @@ -116,7 +116,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/unlistedProperty/MyClass.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/unlistedProperty/MyClass.html index 92a5073c6..abfec5e9b 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/unlistedProperty/MyClass.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/unlistedProperty/MyClass.html @@ -79,7 +79,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/unlistedProperty/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/unlistedProperty/index.html index ff585229d..622c2b0f5 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/unlistedProperty/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package1/1.2.3/unlistedProperty/index.html @@ -105,7 +105,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package2/4.5.6/Module3/Class Two {}.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package2/4.5.6/Module3/Class Two {}.html index c6cca18fb..1e39961e8 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package2/4.5.6/Module3/Class Two {}.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package2/4.5.6/Module3/Class Two {}.html @@ -97,7 +97,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package2/4.5.6/Module3/Class3.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package2/4.5.6/Module3/Class3.html index 194e613bd..cf8a77662 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package2/4.5.6/Module3/Class3.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package2/4.5.6/Module3/Class3.html @@ -97,7 +97,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package2/4.5.6/Module3/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package2/4.5.6/Module3/index.html index 15a454b82..3be7c8f76 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package2/4.5.6/Module3/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/com.package2/4.5.6/Module3/index.html @@ -128,7 +128,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/localhost(3a)0/birds/0.5.0/Bird/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/localhost(3a)0/birds/0.5.0/Bird/index.html index 520be3092..8a4798f0f 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/localhost(3a)0/birds/0.5.0/Bird/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/localhost(3a)0/birds/0.5.0/Bird/index.html @@ -126,7 +126,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/localhost(3a)0/birds/0.5.0/allFruit/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/localhost(3a)0/birds/0.5.0/allFruit/index.html index 9a1898406..46fea37d5 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/localhost(3a)0/birds/0.5.0/allFruit/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/localhost(3a)0/birds/0.5.0/allFruit/index.html @@ -126,7 +126,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/localhost(3a)0/birds/0.5.0/catalog/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/localhost(3a)0/birds/0.5.0/catalog/index.html index e0f043a51..adc5f3b74 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/localhost(3a)0/birds/0.5.0/catalog/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/localhost(3a)0/birds/0.5.0/catalog/index.html @@ -126,7 +126,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/localhost(3a)0/deprecated/1.0.0/deprecated/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/localhost(3a)0/deprecated/1.0.0/deprecated/index.html index d28044486..c2dd80621 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/localhost(3a)0/deprecated/1.0.0/deprecated/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/localhost(3a)0/deprecated/1.0.0/deprecated/index.html @@ -128,7 +128,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/localhost(3a)0/fruit/1.1.0/Fruit/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/localhost(3a)0/fruit/1.1.0/Fruit/index.html index 50707f712..305295032 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/localhost(3a)0/fruit/1.1.0/Fruit/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-1/localhost(3a)0/fruit/1.1.0/Fruit/index.html @@ -113,7 +113,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/Module Containing Spaces/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/Module Containing Spaces/index.html index 38a5fcc8f..65fe64c72 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/Module Containing Spaces/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/Module Containing Spaces/index.html @@ -105,7 +105,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/baseModule/BaseClass.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/baseModule/BaseClass.html index ddb2f5424..d366d30ca 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/baseModule/BaseClass.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/baseModule/BaseClass.html @@ -79,7 +79,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/baseModule/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/baseModule/index.html index b1a220930..1b12b03dc 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/baseModule/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/baseModule/index.html @@ -116,7 +116,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classAnnotations/AnnotatedClass.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classAnnotations/AnnotatedClass.html index 084024b0f..8146b55dd 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classAnnotations/AnnotatedClass.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classAnnotations/AnnotatedClass.html @@ -82,7 +82,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classAnnotations/AnnotatedClss.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classAnnotations/AnnotatedClss.html index ded131e97..9a760ffa0 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classAnnotations/AnnotatedClss.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classAnnotations/AnnotatedClss.html @@ -84,7 +84,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classAnnotations/AnnotatedClssWithExpandableComment.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classAnnotations/AnnotatedClssWithExpandableComment.html index 40baa3c9e..4667fbeb0 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classAnnotations/AnnotatedClssWithExpandableComment.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classAnnotations/AnnotatedClssWithExpandableComment.html @@ -84,7 +84,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classAnnotations/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classAnnotations/index.html index a3ede57bb..8d0c26328 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classAnnotations/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classAnnotations/index.html @@ -105,7 +105,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classComments/Comments1.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classComments/Comments1.html index 3fd66de13..bb316f9e8 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classComments/Comments1.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classComments/Comments1.html @@ -79,7 +79,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classComments/Comments2.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classComments/Comments2.html index 7251e67e6..638726ec3 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classComments/Comments2.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classComments/Comments2.html @@ -79,7 +79,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classComments/Comments3.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classComments/Comments3.html index cbdd47863..9fcc55488 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classComments/Comments3.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classComments/Comments3.html @@ -80,7 +80,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classComments/Comments4.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classComments/Comments4.html index 6811e2f6d..fed626c9b 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classComments/Comments4.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classComments/Comments4.html @@ -84,7 +84,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classComments/Comments5.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classComments/Comments5.html index 47e1e53c9..497083912 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classComments/Comments5.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classComments/Comments5.html @@ -80,7 +80,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classComments/Comments6.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classComments/Comments6.html index 0445ff447..909eb953e 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classComments/Comments6.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classComments/Comments6.html @@ -82,7 +82,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classComments/Comments7.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classComments/Comments7.html index 5184fba22..f7b4e48ee 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classComments/Comments7.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classComments/Comments7.html @@ -80,7 +80,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classComments/Comments8.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classComments/Comments8.html index 2f5d6936c..c95141ccb 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classComments/Comments8.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classComments/Comments8.html @@ -131,7 +131,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classComments/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classComments/index.html index 81791d7e5..b9d49ddd6 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classComments/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classComments/index.html @@ -175,7 +175,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classInheritance/MyClass1.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classInheritance/MyClass1.html index 7c4d757ad..efd1ed440 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classInheritance/MyClass1.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classInheritance/MyClass1.html @@ -98,7 +98,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classInheritance/MyClass2.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classInheritance/MyClass2.html index 0070cc5b2..7441d300a 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classInheritance/MyClass2.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classInheritance/MyClass2.html @@ -109,7 +109,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classInheritance/MyClass3.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classInheritance/MyClass3.html index 3c0b294a3..e0fd03373 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classInheritance/MyClass3.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classInheritance/MyClass3.html @@ -109,7 +109,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classInheritance/MyClass4.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classInheritance/MyClass4.html index 487022eec..f9e3b2d10 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classInheritance/MyClass4.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classInheritance/MyClass4.html @@ -120,7 +120,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classInheritance/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classInheritance/index.html index aa47831e7..f13df8520 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classInheritance/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classInheritance/index.html @@ -106,7 +106,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classMethodComments/Comments.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classMethodComments/Comments.html index a7968c272..7d5f559f9 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classMethodComments/Comments.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classMethodComments/Comments.html @@ -79,7 +79,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classMethodComments/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classMethodComments/index.html index 9802bf478..2083b2d20 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classMethodComments/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classMethodComments/index.html @@ -106,7 +106,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classMethodModifiers/Modifiers.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classMethodModifiers/Modifiers.html index fad4c9c1a..6580a8880 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classMethodModifiers/Modifiers.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classMethodModifiers/Modifiers.html @@ -79,7 +79,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classMethodModifiers/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classMethodModifiers/index.html index f74558369..de7d2cf52 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classMethodModifiers/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classMethodModifiers/index.html @@ -106,7 +106,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classMethodTypeAnnotations/TypeAnnotations.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classMethodTypeAnnotations/TypeAnnotations.html index 4f504e525..67a3d4ac3 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classMethodTypeAnnotations/TypeAnnotations.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classMethodTypeAnnotations/TypeAnnotations.html @@ -79,7 +79,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classMethodTypeAnnotations/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classMethodTypeAnnotations/index.html index 50ad8e81d..ccb54de71 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classMethodTypeAnnotations/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classMethodTypeAnnotations/index.html @@ -106,7 +106,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classMethodTypeReferences/MyClass.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classMethodTypeReferences/MyClass.html index 01b9b698c..3b5e9964a 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classMethodTypeReferences/MyClass.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classMethodTypeReferences/MyClass.html @@ -79,7 +79,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classMethodTypeReferences/TypeReferences.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classMethodTypeReferences/TypeReferences.html index ccb964fa8..9701f2f05 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classMethodTypeReferences/TypeReferences.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classMethodTypeReferences/TypeReferences.html @@ -79,7 +79,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classMethodTypeReferences/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classMethodTypeReferences/index.html index 642f29bea..ba9a5de84 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classMethodTypeReferences/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classMethodTypeReferences/index.html @@ -107,7 +107,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classPropertyAnnotations/ClassWithAnnotatedProperty.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classPropertyAnnotations/ClassWithAnnotatedProperty.html index 612bfb053..12c158bf2 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classPropertyAnnotations/ClassWithAnnotatedProperty.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classPropertyAnnotations/ClassWithAnnotatedProperty.html @@ -97,7 +97,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classPropertyAnnotations/UserDefinedAnnotation.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classPropertyAnnotations/UserDefinedAnnotation.html index 8eea5a54e..f35d588b8 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classPropertyAnnotations/UserDefinedAnnotation.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classPropertyAnnotations/UserDefinedAnnotation.html @@ -108,7 +108,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classPropertyAnnotations/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classPropertyAnnotations/index.html index 416e8a3db..0b725ac37 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classPropertyAnnotations/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classPropertyAnnotations/index.html @@ -105,7 +105,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classPropertyComments/Comments.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classPropertyComments/Comments.html index a60749d1c..4deebe067 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classPropertyComments/Comments.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classPropertyComments/Comments.html @@ -172,7 +172,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classPropertyComments/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classPropertyComments/index.html index 06a1af20d..e5ed063f0 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classPropertyComments/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classPropertyComments/index.html @@ -106,7 +106,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classPropertyModifiers/Modifiers.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classPropertyModifiers/Modifiers.html index 3edc2e14a..ee7b01eb7 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classPropertyModifiers/Modifiers.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classPropertyModifiers/Modifiers.html @@ -110,7 +110,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classPropertyModifiers/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classPropertyModifiers/index.html index 7e9bc2a47..225682643 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classPropertyModifiers/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classPropertyModifiers/index.html @@ -106,7 +106,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classPropertyTypeAnnotations/TypeAnnotations.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classPropertyTypeAnnotations/TypeAnnotations.html index 351f800d6..04e5504db 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classPropertyTypeAnnotations/TypeAnnotations.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classPropertyTypeAnnotations/TypeAnnotations.html @@ -206,7 +206,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classPropertyTypeAnnotations/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classPropertyTypeAnnotations/index.html index 75963961c..d78db8874 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classPropertyTypeAnnotations/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classPropertyTypeAnnotations/index.html @@ -106,7 +106,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classPropertyTypeReferences/MyClass.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classPropertyTypeReferences/MyClass.html index 6f7336638..b1032e6e4 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classPropertyTypeReferences/MyClass.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classPropertyTypeReferences/MyClass.html @@ -79,7 +79,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classPropertyTypeReferences/TypeReferences.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classPropertyTypeReferences/TypeReferences.html index 6738f8a70..fd479a2e5 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classPropertyTypeReferences/TypeReferences.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classPropertyTypeReferences/TypeReferences.html @@ -194,7 +194,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classPropertyTypeReferences/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classPropertyTypeReferences/index.html index e757f293c..6eb796be2 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classPropertyTypeReferences/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classPropertyTypeReferences/index.html @@ -107,7 +107,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classTypeConstraints/Address.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classTypeConstraints/Address.html index 8498c3fb2..97021a64d 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classTypeConstraints/Address.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classTypeConstraints/Address.html @@ -108,7 +108,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classTypeConstraints/Person1.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classTypeConstraints/Person1.html index a28041804..acda81518 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classTypeConstraints/Person1.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classTypeConstraints/Person1.html @@ -108,7 +108,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classTypeConstraints/Person2.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classTypeConstraints/Person2.html index 87f4b6b17..5a089f54f 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classTypeConstraints/Person2.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classTypeConstraints/Person2.html @@ -97,7 +97,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classTypeConstraints/Project.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classTypeConstraints/Project.html index 3fa13b668..c347a8274 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classTypeConstraints/Project.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classTypeConstraints/Project.html @@ -108,7 +108,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classTypeConstraints/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classTypeConstraints/index.html index 94c9f4cfb..41263558d 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classTypeConstraints/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/classTypeConstraints/index.html @@ -116,7 +116,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/docExampleSubject1/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/docExampleSubject1/index.html index 0bbbbc075..63c3b3925 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/docExampleSubject1/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/docExampleSubject1/index.html @@ -117,7 +117,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/docExampleSubject2/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/docExampleSubject2/index.html index e4e622d03..2c1cb5a72 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/docExampleSubject2/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/docExampleSubject2/index.html @@ -117,7 +117,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/docLinks/Person.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/docLinks/Person.html index 00696b31e..97c6c15d8 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/docLinks/Person.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/docLinks/Person.html @@ -116,7 +116,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/docLinks/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/docLinks/index.html index 3a061c53c..4a590d8fd 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/docLinks/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/docLinks/index.html @@ -135,7 +135,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/methodAnnotations/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/methodAnnotations/index.html index 834311fdb..38c3bacfb 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/methodAnnotations/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/methodAnnotations/index.html @@ -104,7 +104,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/moduleComments/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/moduleComments/index.html index 24f298bde..67cfe94b4 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/moduleComments/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/moduleComments/index.html @@ -156,7 +156,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/moduleExtend/ExtendClass.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/moduleExtend/ExtendClass.html index 781c74702..f4fb6a91a 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/moduleExtend/ExtendClass.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/moduleExtend/ExtendClass.html @@ -79,7 +79,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/moduleExtend/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/moduleExtend/index.html index 051796cca..7d8de1cb2 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/moduleExtend/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/moduleExtend/index.html @@ -127,7 +127,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/moduleInfoAnnotation/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/moduleInfoAnnotation/index.html index 96d2e0f3f..a7c5fda17 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/moduleInfoAnnotation/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/moduleInfoAnnotation/index.html @@ -106,7 +106,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/moduleMethodCommentInheritance/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/moduleMethodCommentInheritance/index.html index 1af9eee40..c73cfdd21 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/moduleMethodCommentInheritance/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/moduleMethodCommentInheritance/index.html @@ -104,7 +104,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/moduleMethodComments/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/moduleMethodComments/index.html index 0fdd243a1..e0b44364a 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/moduleMethodComments/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/moduleMethodComments/index.html @@ -105,7 +105,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/moduleMethodModifiers/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/moduleMethodModifiers/index.html index 06c96ad88..edd77d032 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/moduleMethodModifiers/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/moduleMethodModifiers/index.html @@ -105,7 +105,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/moduleMethodTypeAnnotations/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/moduleMethodTypeAnnotations/index.html index b1bc4c076..3fe42386b 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/moduleMethodTypeAnnotations/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/moduleMethodTypeAnnotations/index.html @@ -105,7 +105,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/moduleMethodTypeReferences/MyClass.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/moduleMethodTypeReferences/MyClass.html index e0a019a52..64e8d5f90 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/moduleMethodTypeReferences/MyClass.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/moduleMethodTypeReferences/MyClass.html @@ -79,7 +79,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/moduleMethodTypeReferences/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/moduleMethodTypeReferences/index.html index 939ebf739..ca3b8e42d 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/moduleMethodTypeReferences/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/moduleMethodTypeReferences/index.html @@ -107,7 +107,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/modulePropertyAnnotations/UserDefinedAnnotation.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/modulePropertyAnnotations/UserDefinedAnnotation.html index 993894f49..3fc3dc67d 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/modulePropertyAnnotations/UserDefinedAnnotation.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/modulePropertyAnnotations/UserDefinedAnnotation.html @@ -108,7 +108,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/modulePropertyAnnotations/UserDefinedAnnotation1.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/modulePropertyAnnotations/UserDefinedAnnotation1.html index a13e63fb8..73ef7a1f5 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/modulePropertyAnnotations/UserDefinedAnnotation1.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/modulePropertyAnnotations/UserDefinedAnnotation1.html @@ -97,7 +97,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/modulePropertyAnnotations/UserDefinedAnnotation2.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/modulePropertyAnnotations/UserDefinedAnnotation2.html index e1b717574..aab56d91d 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/modulePropertyAnnotations/UserDefinedAnnotation2.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/modulePropertyAnnotations/UserDefinedAnnotation2.html @@ -97,7 +97,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/modulePropertyAnnotations/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/modulePropertyAnnotations/index.html index fd448c89a..3ad25ef8e 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/modulePropertyAnnotations/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/modulePropertyAnnotations/index.html @@ -187,7 +187,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/modulePropertyCommentInheritance/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/modulePropertyCommentInheritance/index.html index fb6fcbc08..dc1811232 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/modulePropertyCommentInheritance/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/modulePropertyCommentInheritance/index.html @@ -237,7 +237,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/modulePropertyComments/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/modulePropertyComments/index.html index 5ae1d42b2..350d76376 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/modulePropertyComments/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/modulePropertyComments/index.html @@ -238,7 +238,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/modulePropertyModifiers/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/modulePropertyModifiers/index.html index 91622fcdb..ea80ad163 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/modulePropertyModifiers/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/modulePropertyModifiers/index.html @@ -117,7 +117,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/modulePropertyTypeAnnotations/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/modulePropertyTypeAnnotations/index.html index d4a128e4a..88a8a946d 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/modulePropertyTypeAnnotations/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/modulePropertyTypeAnnotations/index.html @@ -225,7 +225,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/modulePropertyTypeReferences/MyClass.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/modulePropertyTypeReferences/MyClass.html index 1de8cc07c..d9ca39957 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/modulePropertyTypeReferences/MyClass.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/modulePropertyTypeReferences/MyClass.html @@ -79,7 +79,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/modulePropertyTypeReferences/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/modulePropertyTypeReferences/index.html index 5f4cad3a2..f27573ecf 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/modulePropertyTypeReferences/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/modulePropertyTypeReferences/index.html @@ -215,7 +215,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/moduleTypes1/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/moduleTypes1/index.html index 76233af02..1f137964e 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/moduleTypes1/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/moduleTypes1/index.html @@ -115,7 +115,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/moduleTypes2/Foo.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/moduleTypes2/Foo.html index e6e4735ce..51ed5148b 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/moduleTypes2/Foo.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/moduleTypes2/Foo.html @@ -174,7 +174,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/moduleTypes2/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/moduleTypes2/index.html index 76bfbe855..9697baf3e 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/moduleTypes2/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/moduleTypes2/index.html @@ -193,7 +193,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/nested/nested2/nestedModule/MyClass.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/nested/nested2/nestedModule/MyClass.html index 0d7b9a592..ff00e6bc3 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/nested/nested2/nestedModule/MyClass.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/nested/nested2/nestedModule/MyClass.html @@ -79,7 +79,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/nested/nested2/nestedModule/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/nested/nested2/nestedModule/index.html index 322980f86..45fe361a2 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/nested/nested2/nestedModule/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/nested/nested2/nestedModule/index.html @@ -116,7 +116,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/shared/MyClass.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/shared/MyClass.html index 031f92a6a..28d24ac03 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/shared/MyClass.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/shared/MyClass.html @@ -79,7 +79,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/shared/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/shared/index.html index 190d3585a..3fed58db5 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/shared/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/shared/index.html @@ -105,7 +105,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/ternalPackage/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/ternalPackage/index.html index 57dc9fb07..69d25af27 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/ternalPackage/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/ternalPackage/index.html @@ -116,7 +116,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/typeAliasInheritance/Person2.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/typeAliasInheritance/Person2.html index 09ead29e3..b03263ca0 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/typeAliasInheritance/Person2.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/typeAliasInheritance/Person2.html @@ -153,7 +153,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/typeAliasInheritance/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/typeAliasInheritance/index.html index 1653952d6..16d514625 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/typeAliasInheritance/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/typeAliasInheritance/index.html @@ -173,7 +173,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/typealiases/Person.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/typealiases/Person.html index d2c348a59..0f113aa6c 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/typealiases/Person.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/typealiases/Person.html @@ -131,7 +131,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/typealiases/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/typealiases/index.html index f40e98f62..e5a2a5da9 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/typealiases/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/typealiases/index.html @@ -151,7 +151,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/typealiases2/Foo.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/typealiases2/Foo.html index a73865abc..015094365 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/typealiases2/Foo.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/typealiases2/Foo.html @@ -185,7 +185,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/typealiases2/Person.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/typealiases2/Person.html index cdb428f7a..b904ad650 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/typealiases2/Person.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/typealiases2/Person.html @@ -97,7 +97,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/typealiases2/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/typealiases2/index.html index e4340119b..299d9d42e 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/typealiases2/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/typealiases2/index.html @@ -205,7 +205,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/unionTypes/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/unionTypes/index.html index 6229ded88..fb6b811db 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/unionTypes/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/unionTypes/index.html @@ -170,7 +170,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/unlistedClass/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/unlistedClass/index.html index 1e54c731b..40b97f982 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/unlistedClass/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/unlistedClass/index.html @@ -115,7 +115,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/unlistedMethod/MyClass.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/unlistedMethod/MyClass.html index e84026206..a9570e13e 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/unlistedMethod/MyClass.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/unlistedMethod/MyClass.html @@ -79,7 +79,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/unlistedMethod/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/unlistedMethod/index.html index ec46e8552..058aa0848 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/unlistedMethod/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/unlistedMethod/index.html @@ -116,7 +116,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/unlistedProperty/MyClass.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/unlistedProperty/MyClass.html index 92a5073c6..abfec5e9b 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/unlistedProperty/MyClass.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/unlistedProperty/MyClass.html @@ -79,7 +79,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/unlistedProperty/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/unlistedProperty/index.html index ff585229d..622c2b0f5 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/unlistedProperty/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package1/1.2.3/unlistedProperty/index.html @@ -105,7 +105,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package2/4.5.6/Module3/Class Two {}.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package2/4.5.6/Module3/Class Two {}.html index c6cca18fb..1e39961e8 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package2/4.5.6/Module3/Class Two {}.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package2/4.5.6/Module3/Class Two {}.html @@ -97,7 +97,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package2/4.5.6/Module3/Class3.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package2/4.5.6/Module3/Class3.html index 194e613bd..cf8a77662 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package2/4.5.6/Module3/Class3.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package2/4.5.6/Module3/Class3.html @@ -97,7 +97,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package2/4.5.6/Module3/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package2/4.5.6/Module3/index.html index 15a454b82..3be7c8f76 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package2/4.5.6/Module3/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/com.package2/4.5.6/Module3/index.html @@ -128,7 +128,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/localhost(3a)0/birds/0.5.0/Bird/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/localhost(3a)0/birds/0.5.0/Bird/index.html index 520be3092..8a4798f0f 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/localhost(3a)0/birds/0.5.0/Bird/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/localhost(3a)0/birds/0.5.0/Bird/index.html @@ -126,7 +126,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/localhost(3a)0/birds/0.5.0/allFruit/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/localhost(3a)0/birds/0.5.0/allFruit/index.html index 9a1898406..46fea37d5 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/localhost(3a)0/birds/0.5.0/allFruit/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/localhost(3a)0/birds/0.5.0/allFruit/index.html @@ -126,7 +126,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/localhost(3a)0/birds/0.5.0/catalog/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/localhost(3a)0/birds/0.5.0/catalog/index.html index e0f043a51..adc5f3b74 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/localhost(3a)0/birds/0.5.0/catalog/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/localhost(3a)0/birds/0.5.0/catalog/index.html @@ -126,7 +126,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/localhost(3a)0/birds/0.6.0/Bird/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/localhost(3a)0/birds/0.6.0/Bird/index.html index 5be9d0385..d5f1847e2 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/localhost(3a)0/birds/0.6.0/Bird/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/localhost(3a)0/birds/0.6.0/Bird/index.html @@ -126,7 +126,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/localhost(3a)0/birds/0.6.0/allFruit/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/localhost(3a)0/birds/0.6.0/allFruit/index.html index 2e499f5a2..a2f2d2895 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/localhost(3a)0/birds/0.6.0/allFruit/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/localhost(3a)0/birds/0.6.0/allFruit/index.html @@ -126,7 +126,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/localhost(3a)0/birds/0.6.0/catalog/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/localhost(3a)0/birds/0.6.0/catalog/index.html index d72c0277f..762d87085 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/localhost(3a)0/birds/0.6.0/catalog/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/localhost(3a)0/birds/0.6.0/catalog/index.html @@ -126,7 +126,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/localhost(3a)0/birds/0.7.0/Bird/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/localhost(3a)0/birds/0.7.0/Bird/index.html index 4ee512d93..4ed203550 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/localhost(3a)0/birds/0.7.0/Bird/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/localhost(3a)0/birds/0.7.0/Bird/index.html @@ -126,7 +126,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/localhost(3a)0/birds/0.7.0/allFruit/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/localhost(3a)0/birds/0.7.0/allFruit/index.html index 552e05cac..f5773cede 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/localhost(3a)0/birds/0.7.0/allFruit/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/localhost(3a)0/birds/0.7.0/allFruit/index.html @@ -126,7 +126,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/localhost(3a)0/birds/0.7.0/catalog/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/localhost(3a)0/birds/0.7.0/catalog/index.html index 4c2d5e4da..effa34745 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/localhost(3a)0/birds/0.7.0/catalog/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/localhost(3a)0/birds/0.7.0/catalog/index.html @@ -126,7 +126,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/localhost(3a)0/deprecated/1.0.0/deprecated/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/localhost(3a)0/deprecated/1.0.0/deprecated/index.html index d28044486..c2dd80621 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/localhost(3a)0/deprecated/1.0.0/deprecated/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/localhost(3a)0/deprecated/1.0.0/deprecated/index.html @@ -128,7 +128,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/localhost(3a)0/fruit/1.1.0/Fruit/index.html b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/localhost(3a)0/fruit/1.1.0/Fruit/index.html index 50707f712..305295032 100644 --- a/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/localhost(3a)0/fruit/1.1.0/Fruit/index.html +++ b/pkl-doc/src/test/files/DocGeneratorTest/output/run-2/localhost(3a)0/fruit/1.1.0/Fruit/index.html @@ -113,7 +113,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/SinglePackageTest/output/com.package1/1.2.3/minimal/Person.html b/pkl-doc/src/test/files/SinglePackageTest/output/com.package1/1.2.3/minimal/Person.html index ee584b3cd..86d06f854 100644 --- a/pkl-doc/src/test/files/SinglePackageTest/output/com.package1/1.2.3/minimal/Person.html +++ b/pkl-doc/src/test/files/SinglePackageTest/output/com.package1/1.2.3/minimal/Person.html @@ -99,7 +99,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/SinglePackageTest/output/com.package1/1.2.3/minimal/index.html b/pkl-doc/src/test/files/SinglePackageTest/output/com.package1/1.2.3/minimal/index.html index ac7c7b510..cdda96815 100644 --- a/pkl-doc/src/test/files/SinglePackageTest/output/com.package1/1.2.3/minimal/index.html +++ b/pkl-doc/src/test/files/SinglePackageTest/output/com.package1/1.2.3/minimal/index.html @@ -118,7 +118,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/SinglePackageTest/output/com.package1/4.5.6/minimal/Person.html b/pkl-doc/src/test/files/SinglePackageTest/output/com.package1/4.5.6/minimal/Person.html index 5b6fca05e..7589a28aa 100644 --- a/pkl-doc/src/test/files/SinglePackageTest/output/com.package1/4.5.6/minimal/Person.html +++ b/pkl-doc/src/test/files/SinglePackageTest/output/com.package1/4.5.6/minimal/Person.html @@ -99,7 +99,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/SinglePackageTest/output/com.package1/4.5.6/minimal/index.html b/pkl-doc/src/test/files/SinglePackageTest/output/com.package1/4.5.6/minimal/index.html index c15feb973..c5efbbf97 100644 --- a/pkl-doc/src/test/files/SinglePackageTest/output/com.package1/4.5.6/minimal/index.html +++ b/pkl-doc/src/test/files/SinglePackageTest/output/com.package1/4.5.6/minimal/index.html @@ -118,7 +118,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/SinglePackageTest/output/com.package1/current/minimal/Person.html b/pkl-doc/src/test/files/SinglePackageTest/output/com.package1/current/minimal/Person.html index 5b6fca05e..7589a28aa 100644 --- a/pkl-doc/src/test/files/SinglePackageTest/output/com.package1/current/minimal/Person.html +++ b/pkl-doc/src/test/files/SinglePackageTest/output/com.package1/current/minimal/Person.html @@ -99,7 +99,7 @@

Methods(function

-
Any.ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
Any.ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

diff --git a/pkl-doc/src/test/files/SinglePackageTest/output/com.package1/current/minimal/index.html b/pkl-doc/src/test/files/SinglePackageTest/output/com.package1/current/minimal/index.html index c15feb973..c5efbbf97 100644 --- a/pkl-doc/src/test/files/SinglePackageTest/output/com.package1/current/minimal/index.html +++ b/pkl-doc/src/test/files/SinglePackageTest/output/com.package1/current/minimal/index.html @@ -118,7 +118,7 @@

Methods(function

-
ifNonNull<Result>(transform: (NonNull) -> Result): Result? (pkl.base)Source
+
ifNonNull<Result>(transform: (this) -> Result): Result? (pkl.base)Source

Returns this |> transform if this is non-null, and null otherwise.

From 7e94e9655d5a815bd5b75ad2b779a493fd9c1fbf Mon Sep 17 00:00:00 2001 From: Jen Basch Date: Tue, 28 Jul 2026 12:53:41 -0700 Subject: [PATCH 3/3] Address review feedback --- .../main/java/org/pkl/core/EvaluatorImpl.java | 9 +-- .../org/pkl/core/ast/builder/AstBuilder.java | 80 ++++++++++--------- .../org/pkl/core/ast/builder/SymbolTable.java | 33 +------- .../ast/expression/member/ReadClassNode.java | 75 ----------------- .../java/org/pkl/core/ast/type/TypeNode.java | 23 +++--- .../java/org/pkl/core/repl/ReplServer.java | 3 - .../pkl/core/runtime/CommandSpecParser.java | 2 - .../org/pkl/core/runtime/ModuleCache.java | 15 +--- .../org/pkl/core/runtime/StdLibModule.java | 1 - .../java/org/pkl/core/runtime/VmLanguage.java | 6 +- .../java/org/pkl/core/runtime/VmUtils.java | 6 +- .../org/pkl/core/errorMessages.properties | 34 ++++---- .../input/types/currentModuleType7.pkl | 19 ----- .../output/types/currentModuleType1.err | 8 +- .../output/types/currentModuleType2.err | 8 +- .../output/types/currentModuleType3.err | 8 +- .../output/types/currentModuleType4.err | 2 +- .../output/types/currentModuleType6.err | 2 +- .../output/types/currentModuleType7.pcf | 1 - .../output/types/thisType2.err | 2 +- .../output/types/typeAlias6.err | 1 + 21 files changed, 100 insertions(+), 238 deletions(-) delete mode 100644 pkl-core/src/main/java/org/pkl/core/ast/expression/member/ReadClassNode.java delete mode 100644 pkl-core/src/test/files/LanguageSnippetTests/input/types/currentModuleType7.pkl delete mode 100644 pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType7.pcf diff --git a/pkl-core/src/main/java/org/pkl/core/EvaluatorImpl.java b/pkl-core/src/main/java/org/pkl/core/EvaluatorImpl.java index a45c1271c..7113d4c6f 100644 --- a/pkl-core/src/main/java/org/pkl/core/EvaluatorImpl.java +++ b/pkl-core/src/main/java/org/pkl/core/EvaluatorImpl.java @@ -212,8 +212,7 @@ public Object evaluateExpression(ModuleSource moduleSource, String expression) { moduleSource, (module) -> { var expressionResult = - VmUtils.evaluateExpression( - module, expression, securityManager, moduleResolver, logger); + VmUtils.evaluateExpression(module, expression, securityManager, moduleResolver); if (expressionResult instanceof VmValue value) { value.force(false); return value.export(); @@ -244,8 +243,7 @@ public byte[] evaluateExpressionPklBinary(ModuleSource moduleSource, String expr VmUtils.readMember(VmUtils.readModuleOutput(module), Identifier.VALUE); case "output.bytes" -> VmUtils.readBytesProperty(VmUtils.readModuleOutput(module)); default -> - VmUtils.evaluateExpression( - module, expression, securityManager, moduleResolver, logger); + VmUtils.evaluateExpression(module, expression, securityManager, moduleResolver); }; VmValue.force(expressionResult, false); @@ -266,8 +264,7 @@ public String evaluateExpressionString(ModuleSource moduleSource, String express moduleSource, (module) -> { var expressionResult = - VmUtils.evaluateExpression( - module, expression, securityManager, moduleResolver, logger); + VmUtils.evaluateExpression(module, expression, securityManager, moduleResolver); var toStringNode = ToStringNodeGen.create( VmUtils.unavailableSourceSection(), new ConstantValueNode(expressionResult)); diff --git a/pkl-core/src/main/java/org/pkl/core/ast/builder/AstBuilder.java b/pkl-core/src/main/java/org/pkl/core/ast/builder/AstBuilder.java index 5aba56d21..12e157f09 100644 --- a/pkl-core/src/main/java/org/pkl/core/ast/builder/AstBuilder.java +++ b/pkl-core/src/main/java/org/pkl/core/ast/builder/AstBuilder.java @@ -35,7 +35,6 @@ import java.util.stream.Collectors; import org.graalvm.collections.EconomicMap; import org.jspecify.annotations.Nullable; -import org.pkl.core.Logger; import org.pkl.core.PClassInfo; import org.pkl.core.PklBugException; import org.pkl.core.SecurityManagerException; @@ -122,7 +121,6 @@ import org.pkl.core.ast.expression.member.InvokeSuperMethodNodeGen; import org.pkl.core.ast.expression.member.ReadAmbiguousLocalityPropertyNode; import org.pkl.core.ast.expression.member.ReadLexicalLocalPropertyNode; -import org.pkl.core.ast.expression.member.ReadClassNode; import org.pkl.core.ast.expression.member.ReadPropertyNodeGen; import org.pkl.core.ast.expression.member.ReadQualifiedLocalPropertyNode; import org.pkl.core.ast.expression.member.ReadSuperEntryNode; @@ -291,7 +289,6 @@ public class AstBuilder extends AbstractAstBuilder { private final VmLanguage language; - private final Logger logger; private final ModuleInfo moduleInfo; private final ModuleKey moduleKey; @@ -303,14 +300,9 @@ public class AstBuilder extends AbstractAstBuilder { private final boolean isMethodReturnTypeChecked; public AstBuilder( - Source source, - VmLanguage language, - Logger logger, - ModuleInfo moduleInfo, - ModuleResolver moduleResolver) { + Source source, VmLanguage language, ModuleInfo moduleInfo, ModuleResolver moduleResolver) { super(source); this.language = language; - this.logger = logger; this.moduleInfo = moduleInfo; moduleKey = moduleInfo.getModuleKey(); @@ -325,7 +317,6 @@ public AstBuilder( public static AstBuilder create( Source source, VmLanguage language, - Logger logger, Module ctx, ModuleKey moduleKey, ResolvedModuleKey resolvedModuleKey, @@ -366,7 +357,7 @@ public static AstBuilder create( isAmend); } - return new AstBuilder(source, language, logger, moduleInfo, moduleResolver); + return new AstBuilder(source, language, moduleInfo, moduleResolver); } @Override @@ -382,6 +373,16 @@ public UnresolvedTypeNode visitNothingType(NothingType type) { @Override public UnresolvedTypeNode visitModuleType(ModuleType 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; + } + String errorMessage = null; Object[] errorArgs = new Object[] {}; @@ -391,11 +392,11 @@ public UnresolvedTypeNode visitModuleType(ModuleType type) { scope != null && errorMessage == null; scope = scope.getParent()) { if (scope.isAnnotationScope()) { - errorMessage = "moduleTypeIsNotConstAnnotation"; + errorMessage = "invalidModuleTypeInAnnotation"; } else if (scope.isClassScope()) { - errorMessage = "moduleTypeIsNotConstClass"; + errorMessage = "invalidModuleTypeInClass"; } else if (scope.isTypeAliasScope()) { - errorMessage = "moduleTypeIsNotConstTypeAlias"; + errorMessage = "invalidModuleTypeInTypeAlias"; } } for (var scope = symbolTable.getCurrentScope(); @@ -405,23 +406,24 @@ public UnresolvedTypeNode visitModuleType(ModuleType type) { continue; } if (scope.isPropertyScope()) { - errorMessage = "moduleTypeIsNotConstProperty"; + errorMessage = "invalidModuleTypeInProperty"; errorArgs = new Object[] {scope.getQualifiedName()}; } else if (scope.isMethodScope()) { - errorMessage = "moduleTypeIsNotConstMethod"; + errorMessage = "invalidModuleTypeInMethod"; errorArgs = new Object[] {scope.getQualifiedName()}; } else { + // all possibly const scopes should be covered in one of these loops throw exceptionBuilder().unreachableCode().build(); } } if (errorMessage != null) { - logger.warn( - ErrorMessages.create(errorMessage, errorArgs) - + " This will be an error in a future release.", - VmUtils.createStackFrame(sourceSection, null)); + VmContext.get(null) + .getLogger() + .warn( + ErrorMessages.create(errorMessage, errorArgs) + + " This will be an error in a future release.", + VmUtils.createStackFrame(sourceSection, null)); } - - return new UnresolvedTypeNode.Module(sourceSection); } @Override @@ -429,14 +431,13 @@ public UnresolvedTypeNode visitThisType(ThisType type) { var sourceSection = createSourceSection(type); // need to pass explicit class name for property and method arg/return type annotations // do not need: when in any object or at the module level (where `this` is the receiver's class) - ClassScope classScope = null; - var baseScope = symbolTable.getCurrentScope(); - for (var scope = baseScope; scope != null; scope = scope.getParent()) { + 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) { - classScope = foundClassScope; + className = foundClassScope.getName(); break; } // it's still safe to break on ObjectScope because this is valid: @@ -444,17 +445,25 @@ public UnresolvedTypeNode visitThisType(ThisType type) { if (scope.isTypeAliasScope()) { throw exceptionBuilder() .withSourceSection(sourceSection) - .evalError("invalidSelfTypeUsage", "this", "type alias") + .evalError("invalidThisTypeInTypeAlias") .build(); } } - var getClassNode = - classScope == null - ? new GetReceiverClassNode(sourceSection) - : isBaseModule - ? new GetBaseModuleClassNode(classScope.getName()) - : new ReadClassNode(sourceSection, classScope.getName(), classScope.isLocal()); + 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); } @@ -882,7 +891,6 @@ private ExpressionNode resolvedMethodCall(UnqualifiedAccessExpr expr, ArgumentLi // Assumption: typealiases can only be declared on the module. // If we ever allow typealiases in classes, this code needs to change. if (symbolTable.isInTypeAliasScope && method.isModuleScope()) { - if (scope.isInTypeAliasScope() && method.isModuleScope()) { var getModuleNode = new GetTypeAliasModuleNode(sourceSection); if (method.isObjectMethod()) { return new InvokeQualifiedObjectMethodNode( @@ -1845,13 +1853,11 @@ public ObjectMember visitClass(Class clazz) { org.pkl.core.runtime.Identifier.property(clazz.getName().getValue(), isLocalClass); var annotations = doVisitAnnotations(clazz.getAnnotations(), className); - var supertypeCtx = clazz.getSuperClass(); return symbolTable.enterClass( className, modifiers, typeParameters, - supertypeCtx, scope -> { var bodyNode = clazz.getBody(); @@ -1860,6 +1866,8 @@ public ObjectMember visitClass(Class clazz) { registerClassScopeNames(scope, properties, methods); checkAbstractMethodsAllowed(modifiers, methods, "class"); + var supertypeCtx = clazz.getSuperClass(); + // needs to be inside `enterClass` so that class' type parameters are in scope var supertypeNode = supertypeCtx != null diff --git a/pkl-core/src/main/java/org/pkl/core/ast/builder/SymbolTable.java b/pkl-core/src/main/java/org/pkl/core/ast/builder/SymbolTable.java index 021ca60d6..2f082ad5e 100644 --- a/pkl-core/src/main/java/org/pkl/core/ast/builder/SymbolTable.java +++ b/pkl-core/src/main/java/org/pkl/core/ast/builder/SymbolTable.java @@ -43,7 +43,6 @@ import org.pkl.core.util.ArrayUtils; import org.pkl.core.util.LateInit; import org.pkl.parser.Lexer; -import org.pkl.parser.syntax.Type; public final class SymbolTable { @@ -72,7 +71,6 @@ public ObjectMember enterClass( Identifier name, int modifiers, List typeParameters, - @Nullable Type superClass, Function nodeFactory) { return doEnter( new ClassScope( @@ -81,8 +79,7 @@ public ObjectMember enterClass( toQualifiedName(name), modifiers, new FrameDescriptorBuilder(), - typeParameters, - superClass), + typeParameters), nodeFactory); } @@ -437,10 +434,6 @@ public final boolean isClassScope() { return this instanceof ClassScope; } - public final boolean isTypeAliasScope() { - return this instanceof TypeAliasScope; - } - public final boolean isObjectScope() { return this instanceof ObjectScope; } @@ -481,15 +474,6 @@ public final boolean isTypeAliasScope() { return this instanceof TypeAliasScope; } - public final boolean isInTypeAliasScope() { - for (var scope = this; scope != null; scope = scope.getParent()) { - if (scope.isTypeAliasScope()) { - return true; - } - } - return false; - } - public ConstLevel getConstLevel() { return constLevel; } @@ -1024,8 +1008,6 @@ public EntryOrElementScope( public static final class ClassScope extends TypeParameterizableScope implements LexicalScope { private final boolean isClosed; - private final boolean isLocal; - private final @Nullable Type superClass; public ClassScope( Scope parent, @@ -1033,8 +1015,7 @@ public ClassScope( String qualifiedName, int modifiers, FrameDescriptorBuilder frameDescriptorBuilder, - List typeParameters, - @Nullable Type superClass) { + List typeParameters) { super( parent, name, @@ -1045,8 +1026,6 @@ public ClassScope( EMPTY_INT_ARRAY, EMPTY_INT_ARRAY); isClosed = VmModifier.isClosed(modifiers); - isLocal = VmModifier.isLocal(modifiers); - this.superClass = superClass; } @Override @@ -1062,14 +1041,6 @@ public ClassScope( if (member == null) return null; return new LexicalMethod(false, isClosed, false, member.modifiers, levelsUp); } - - public boolean isLocal() { - return isLocal; - } - - public @Nullable Type getSuperClass() { - return superClass; - } } public static final class TypeAliasScope extends TypeParameterizableScope { diff --git a/pkl-core/src/main/java/org/pkl/core/ast/expression/member/ReadClassNode.java b/pkl-core/src/main/java/org/pkl/core/ast/expression/member/ReadClassNode.java deleted file mode 100644 index 28746e7cd..000000000 --- a/pkl-core/src/main/java/org/pkl/core/ast/expression/member/ReadClassNode.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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.member; - -import com.oracle.truffle.api.CompilerDirectives; -import com.oracle.truffle.api.frame.VirtualFrame; -import com.oracle.truffle.api.nodes.DirectCallNode; -import com.oracle.truffle.api.source.SourceSection; -import org.jspecify.annotations.Nullable; -import org.pkl.core.ast.ExpressionNode; -import org.pkl.core.ast.expression.primary.GetModuleNode; -import org.pkl.core.ast.member.ObjectMember; -import org.pkl.core.runtime.Identifier; -import org.pkl.core.runtime.VmTyped; - -/** Read a class by name from the current receiver's module */ -public final class ReadClassNode extends ExpressionNode { - - private final Identifier className; - private final boolean isLocal; - private @Child ExpressionNode getModuleNode; - @Child private @Nullable DirectCallNode callNode; - - public ReadClassNode(SourceSection sourceSection, Identifier className, boolean isLocal) { - super(sourceSection); - this.getModuleNode = new GetModuleNode(sourceSection); - this.className = className; - this.isLocal = isLocal; - } - - public Object executeGeneric(VirtualFrame frame) { - var module = (VmTyped) getModuleNode.executeGeneric(frame); - - if (!isLocal) { - var clazz = module.getCachedValue(className); - if (clazz != null) return clazz; - } - - var member = module.getMember(className); - assert member != null; - assert member.isClass(); - - if (isLocal) { - var clazz = module.getCachedValue(member); - if (clazz != null) return clazz; - } - - var clazz = getCallNode(member).call(module, module, member.getName()); - module.setCachedValue(isLocal ? member : className, clazz); - return clazz; - } - - private DirectCallNode getCallNode(ObjectMember member) { - if (callNode == null) { - CompilerDirectives.transferToInterpreterAndInvalidate(); - callNode = DirectCallNode.create(member.getCallTarget()); - insert(callNode); - } - assert callNode != null; - return callNode; - } -} diff --git a/pkl-core/src/main/java/org/pkl/core/ast/type/TypeNode.java b/pkl-core/src/main/java/org/pkl/core/ast/type/TypeNode.java index 0efec332a..938908573 100644 --- a/pkl-core/src/main/java/org/pkl/core/ast/type/TypeNode.java +++ b/pkl-core/src/main/java/org/pkl/core/ast/type/TypeNode.java @@ -2909,22 +2909,25 @@ public TypeNode initWriteSlotNode(int slot) { return this; } - private int getCustomThisSlot(VirtualFrame frame) { - var customThisSlot = - frame.getFrameDescriptor().getAuxiliarySlots().get(CustomThisScope.FRAME_SLOT_ID); - if (customThisSlot != null) return customThisSlot; - - CompilerDirectives.transferToInterpreterAndInvalidate(); - return frame.getFrameDescriptor().findOrAddAuxiliarySlot(CustomThisScope.FRAME_SLOT_ID); - } - @ExplodeLoop protected Object executeLazily(VirtualFrame frame, Object value) { + int customThisSlot; + var numberOfAuxiliarySlots = frame.getFrameDescriptor().getNumberOfAuxiliarySlots(); + if (numberOfAuxiliarySlots == 0) { + CompilerDirectives.transferToInterpreterAndInvalidate(); + customThisSlot = + frame.getFrameDescriptor().findOrAddAuxiliarySlot(CustomThisScope.FRAME_SLOT_ID); + } else { + // assertion: we only use auxiliary slots for custom `this`. + assert numberOfAuxiliarySlots == 1; + customThisSlot = 0; + } var ret = childNode.executeLazily(frame, value); + var localContext = language.localContext.get(); var prevShouldTypeCheck = localContext.shouldEagerTypecheck(); localContext.shouldEagerTypecheck(true); - frame.setAuxiliarySlot(getCustomThisSlot(frame), value); + frame.setAuxiliarySlot(customThisSlot, value); try { for (var node : constraintNodes) { node.execute(frame); diff --git a/pkl-core/src/main/java/org/pkl/core/repl/ReplServer.java b/pkl-core/src/main/java/org/pkl/core/repl/ReplServer.java index 0caf1ebd0..3d9503919 100644 --- a/pkl-core/src/main/java/org/pkl/core/repl/ReplServer.java +++ b/pkl-core/src/main/java/org/pkl/core/repl/ReplServer.java @@ -76,7 +76,6 @@ public class ReplServer implements AutoCloseable { private final @Nullable ProjectDependenciesManager projectDependenciesManager; private final boolean color; private final Parser parser = new Parser(); - private final Logger logger; public ReplServer( SecurityManager securityManager, @@ -100,7 +99,6 @@ public ReplServer( this.errorRenderer = new VmExceptionRenderer(new StackTraceRenderer(frameTransformer), color, true); this.color = color; - this.logger = logger; replState = new ReplState(createEmptyReplModule(BaseModule.getModuleClass().getPrototype())); var languageRef = new MutableReference(null); @@ -210,7 +208,6 @@ private void handleNode( new AstBuilder( VmUtils.loadSource(resolved), language, - logger, replState.module.getModuleInfo(), moduleResolver); var mod = parser.parseModule(syntheticModuleText); diff --git a/pkl-core/src/main/java/org/pkl/core/runtime/CommandSpecParser.java b/pkl-core/src/main/java/org/pkl/core/runtime/CommandSpecParser.java index ddb58a66e..720dc8944 100644 --- a/pkl-core/src/main/java/org/pkl/core/runtime/CommandSpecParser.java +++ b/pkl-core/src/main/java/org/pkl/core/runtime/CommandSpecParser.java @@ -1042,12 +1042,10 @@ private CommandSpec.Result evaluateResult(VmTyped module, SubcommandState parent amendModuleNode.getModuleInfo().getModuleKey(), context.getSecurityManager(), context.getModuleResolver(), - context.getLogger(), VmUtils::createEmptyModule, ((moduleKey1, resolvedModuleKey, moduleResolver, - logger, source, emptyModule, importNode) -> { diff --git a/pkl-core/src/main/java/org/pkl/core/runtime/ModuleCache.java b/pkl-core/src/main/java/org/pkl/core/runtime/ModuleCache.java index 54c9889a4..3467a381c 100644 --- a/pkl-core/src/main/java/org/pkl/core/runtime/ModuleCache.java +++ b/pkl-core/src/main/java/org/pkl/core/runtime/ModuleCache.java @@ -28,7 +28,6 @@ import java.util.function.Supplier; import java.util.stream.Collectors; import org.jspecify.annotations.Nullable; -import org.pkl.core.Logger; import org.pkl.core.Release; import org.pkl.core.SecurityManager; import org.pkl.core.SecurityManagerException; @@ -58,7 +57,6 @@ void initialize( ModuleKey moduleKey, ResolvedModuleKey resolvedModuleKey, ModuleResolver moduleResolver, - Logger logger, Source source, VmTyped emptyModule, @Nullable Node importNode); @@ -77,7 +75,6 @@ public synchronized VmTyped getOrLoad( ModuleKey moduleKey, SecurityManager securityManager, ModuleResolver moduleResolver, - Logger logger, Supplier moduleInstantiator, ModuleInitializer moduleInitializer, @Nullable Node importNode) { @@ -139,7 +136,6 @@ public synchronized VmTyped getOrLoad( moduleKey, resolvedKey, moduleResolver, - logger, moduleInstantiator, moduleInitializer, importNode); @@ -165,20 +161,13 @@ public synchronized VmTyped getOrLoad( } return doLoad( - moduleKey, - resolvedKey, - moduleResolver, - logger, - moduleInstantiator, - moduleInitializer, - importNode); + moduleKey, resolvedKey, moduleResolver, moduleInstantiator, moduleInitializer, importNode); } private VmTyped doLoad( ModuleKey moduleKey, ResolvedModuleKey resolvedKey, ModuleResolver moduleResolver, - Logger logger, Supplier moduleInstantiator, ModuleInitializer moduleInitializer, @Nullable Node importNode) { @@ -193,7 +182,7 @@ private VmTyped doLoad( modulesByResolvedUri.put(resolvedKey.getUri(), module); moduleInitializer.initialize( - moduleKey, resolvedKey, moduleResolver, logger, result, module, importNode); + moduleKey, resolvedKey, moduleResolver, result, module, importNode); } catch (Exception e) { // handle error deterministically by caching it and rethrowing it when the module is loaded // again diff --git a/pkl-core/src/main/java/org/pkl/core/runtime/StdLibModule.java b/pkl-core/src/main/java/org/pkl/core/runtime/StdLibModule.java index 9a0f0f8c9..df8bdec3a 100644 --- a/pkl-core/src/main/java/org/pkl/core/runtime/StdLibModule.java +++ b/pkl-core/src/main/java/org/pkl/core/runtime/StdLibModule.java @@ -72,7 +72,6 @@ private static void doLoad(URI uri, VmTyped instance) { moduleKey, (ResolvedModuleKey) moduleKey, vmContext.getModuleResolver(), - vmContext.getLogger(), source, instance, null); diff --git a/pkl-core/src/main/java/org/pkl/core/runtime/VmLanguage.java b/pkl-core/src/main/java/org/pkl/core/runtime/VmLanguage.java index 2f7d6e0e2..961026a9a 100644 --- a/pkl-core/src/main/java/org/pkl/core/runtime/VmLanguage.java +++ b/pkl-core/src/main/java/org/pkl/core/runtime/VmLanguage.java @@ -23,7 +23,6 @@ import com.oracle.truffle.api.nodes.Node; import com.oracle.truffle.api.source.Source; import org.jspecify.annotations.Nullable; -import org.pkl.core.Logger; import org.pkl.core.ast.builder.AstBuilder; import org.pkl.core.module.ModuleKey; import org.pkl.core.module.ResolvedModuleKey; @@ -71,7 +70,6 @@ public VmTyped loadModule(ModuleKey moduleKey) { moduleKey, context.getSecurityManager(), context.getModuleResolver(), - context.getLogger(), VmUtils::createEmptyModule, this::initializeModule, null); @@ -86,7 +84,6 @@ public VmTyped loadModule(ModuleKey moduleKey, @Nullable Node importNode) { moduleKey, context.getSecurityManager(), context.getModuleResolver(), - context.getLogger(), VmUtils::createEmptyModule, this::initializeModule, importNode); @@ -96,7 +93,6 @@ void initializeModule( ModuleKey moduleKey, ResolvedModuleKey resolvedModuleKey, ModuleResolver moduleResolver, - Logger logger, Source source, VmTyped emptyModule, @Nullable Node importNode) { @@ -113,7 +109,7 @@ void initializeModule( var builder = AstBuilder.create( - source, this, logger, moduleContext, moduleKey, resolvedModuleKey, moduleResolver); + source, this, moduleContext, moduleKey, resolvedModuleKey, moduleResolver); var moduleNode = builder.visitModule(moduleContext); moduleNode.getCallTarget().call(emptyModule, emptyModule); MinPklVersionChecker.check(emptyModule, importNode); diff --git a/pkl-core/src/main/java/org/pkl/core/runtime/VmUtils.java b/pkl-core/src/main/java/org/pkl/core/runtime/VmUtils.java index 94613a8d1..7ddcbf5dd 100644 --- a/pkl-core/src/main/java/org/pkl/core/runtime/VmUtils.java +++ b/pkl-core/src/main/java/org/pkl/core/runtime/VmUtils.java @@ -40,7 +40,6 @@ import org.jspecify.annotations.Nullable; import org.organicdesign.fp.collections.ImMap; import org.pkl.core.FileOutput; -import org.pkl.core.Logger; import org.pkl.core.PClassInfo; import org.pkl.core.PObject; import org.pkl.core.SecurityManager; @@ -990,8 +989,7 @@ public static Object evaluateExpression( VmTyped module, String expression, SecurityManager securityManager, - ModuleResolver moduleResolver, - Logger logger) { + ModuleResolver moduleResolver) { org.pkl.parser.syntax.Node node; try { node = parser.parseExpressionInput(expression); @@ -1021,7 +1019,7 @@ public static Object evaluateExpression( resolvedModule, false); var language = VmLanguage.get(null); - var builder = new AstBuilder(source, language, logger, moduleInfo, moduleResolver); + var builder = new AstBuilder(source, language, moduleInfo, moduleResolver); var mod = parser.parseModule(syntheticModuleText); builder.visitModule(mod); var exprNode = builder.visitExpr((Expr) adjustedNode); diff --git a/pkl-core/src/main/resources/org/pkl/core/errorMessages.properties b/pkl-core/src/main/resources/org/pkl/core/errorMessages.properties index 3885589b4..d60f5dcd5 100644 --- a/pkl-core/src/main/resources/org/pkl/core/errorMessages.properties +++ b/pkl-core/src/main/resources/org/pkl/core/errorMessages.properties @@ -259,21 +259,6 @@ Cannot reference `module` within a class body. moduleIsNotConstAnnotation=\ Cannot reference `module` within an annotation body. -moduleTypeIsNotConstProperty=\ -Cannot reference `module` type from const property `{0}`. - -moduleTypeIsNotConstMethod=\ -Cannot reference `module` type from const method `{0}`. - -moduleTypeIsNotConstClass=\ -Cannot reference `module` type within a class body. - -moduleTypeIsNotConstAnnotation=\ -Cannot reference `module` type within an annotation body. - -moduleTypeIsNotConstTypeAlias=\ -Cannot reference `module` type within an annotation body. - outerIsNotConst=\ Cannot reference `outer` from here because it's not `const`. @@ -1224,5 +1209,20 @@ invalidReferenceTypeAnnotationWithConstraint=\ cannotInstallPackageWithNoCache=\ Cannot install package to module cache dir when module cache is disabled. -invalidSelfTypeUsage=\ -Cannot declare `{0}` types inside {1} bodies. +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. diff --git a/pkl-core/src/test/files/LanguageSnippetTests/input/types/currentModuleType7.pkl b/pkl-core/src/test/files/LanguageSnippetTests/input/types/currentModuleType7.pkl deleted file mode 100644 index 725947381..000000000 --- a/pkl-core/src/test/files/LanguageSnippetTests/input/types/currentModuleType7.pkl +++ /dev/null @@ -1,19 +0,0 @@ -// test that `module` type use in annotations is allowed -@Foo { baz = bar is module } -module currentModuleType7 - -@Foo { baz = bar is module } -typealias Qux = Foo - -@Foo { baz = bar is module } -class Quux { - @Foo { baz = bar is module } - corge = 2 -} - -class Foo extends Annotation { - bar: Int = 1 - baz: Boolean -} - -ok = true diff --git a/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType1.err b/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType1.err index 958b97784..b9573396e 100644 --- a/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType1.err +++ b/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType1.err @@ -1,5 +1,5 @@ result = "ok" -pkl: WARN: Cannot declare `module` types inside class bodies. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType1.pkl) -pkl: WARN: Cannot declare `module` types inside class bodies. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType1.pkl) -pkl: WARN: Cannot declare `module` types inside class bodies. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType1.pkl) -pkl: WARN: Cannot declare `module` types inside class bodies. 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) +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) diff --git a/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType2.err b/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType2.err index e9eab50e0..8eee1b684 100644 --- a/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType2.err +++ b/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType2.err @@ -1,5 +1,5 @@ result = "ok" -pkl: WARN: Cannot declare `module` types inside class bodies. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType2.pkl) -pkl: WARN: Cannot declare `module` types inside class bodies. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType2.pkl) -pkl: WARN: Cannot declare `module` types inside class bodies. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType2.pkl) -pkl: WARN: Cannot declare `module` types inside class bodies. 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) +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) diff --git a/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType3.err b/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType3.err index e9eab50e0..8eee1b684 100644 --- a/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType3.err +++ b/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType3.err @@ -1,5 +1,5 @@ result = "ok" -pkl: WARN: Cannot declare `module` types inside class bodies. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType2.pkl) -pkl: WARN: Cannot declare `module` types inside class bodies. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType2.pkl) -pkl: WARN: Cannot declare `module` types inside class bodies. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType2.pkl) -pkl: WARN: Cannot declare `module` types inside class bodies. 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) +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) diff --git a/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType4.err b/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType4.err index 83ac9dd01..1fb81f0fc 100644 --- a/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType4.err +++ b/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType4.err @@ -1,6 +1,6 @@ qux = 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 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 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 method `currentModuleType4#quux`. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType4.pkl) diff --git a/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType6.err b/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType6.err index 0b2bb10f2..c7fd6bed2 100644 --- a/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType6.err +++ b/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType6.err @@ -16,4 +16,4 @@ res3 { mod2x = -1 } res4 = "Expected value of type `currentModuleType6#ModuleSubclass`, but got type `moduleTypeProperty`. Value: new ModuleClass { x = ?; y = ?; modName = ? }" -pkl: WARN: Cannot declare `module` types inside class bodies. This will be an error in a future release. (file:///$snippetsDir/input/types/currentModuleType6.pkl) +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) diff --git a/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType7.pcf b/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType7.pcf deleted file mode 100644 index 0198e4182..000000000 --- a/pkl-core/src/test/files/LanguageSnippetTests/output/types/currentModuleType7.pcf +++ /dev/null @@ -1 +0,0 @@ -ok = true diff --git a/pkl-core/src/test/files/LanguageSnippetTests/output/types/thisType2.err b/pkl-core/src/test/files/LanguageSnippetTests/output/types/thisType2.err index dcc376481..85f4da737 100644 --- a/pkl-core/src/test/files/LanguageSnippetTests/output/types/thisType2.err +++ b/pkl-core/src/test/files/LanguageSnippetTests/output/types/thisType2.err @@ -1,5 +1,5 @@ –– Pkl Error –– -Cannot declare `this` types inside type alias bodies. +Cannot reference `this` type within a type alias body. x | typealias Foo = this ^^^^ diff --git a/pkl-core/src/test/files/LanguageSnippetTests/output/types/typeAlias6.err b/pkl-core/src/test/files/LanguageSnippetTests/output/types/typeAlias6.err index 7ae49d5a9..15e7ebd20 100644 --- a/pkl-core/src/test/files/LanguageSnippetTests/output/types/typeAlias6.err +++ b/pkl-core/src/test/files/LanguageSnippetTests/output/types/typeAlias6.err @@ -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 –– Expected value of type `typeAliasModule`, but got type `typeAlias6`. Value: new ModuleClass { res = ? }