// TypeAlias.pkl
module TypeAlias
foo: TypeAlias = UInt
Output (with compiler errors inlined as comments):
// TypeAlias.swift
// Code generated from Pkl module `TypeAlias`. DO NOT EDIT.
import PklSwift
public enum TypeAlias {}
extension TypeAlias {
public struct Module: PklRegisteredType, Decodable, Hashable, Sendable {
// ^^^^^^
// Type 'TypeAlias.Module' does not conform to protocol 'Equatable'
public static let registeredIdentifier: String = "TypeAlias"
public var foo: TypeAlias
// ^^^
// Stored property 'foo' of 'Sendable'-conforming struct
// 'Module' has non-Sendable type 'TypeAlias'
public init(foo: TypeAlias) {
self.foo = foo
}
}
/// Load the Pkl module at the given source and evaluate it into `TypeAlias.Module`.
///
/// - Parameter source: The source of the Pkl module.
public static func loadFrom(source: ModuleSource) async throws -> TypeAlias.Module {
try await PklSwift.withEvaluator { evaluator in
try await loadFrom(evaluator: evaluator, source: source)
}
}
/// Load the Pkl module at the given source and evaluate it with the given evaluator into
/// `TypeAlias.Module`.
///
/// - Parameter evaluator: The evaluator to use for evaluation.
/// - Parameter source: The module to evaluate.
public static func loadFrom(
evaluator: PklSwift.Evaluator,
source: PklSwift.ModuleSource
) async throws -> TypeAlias.Module {
try await evaluator.evaluateModule(source: source, as: Module.self)
}
}
Code generation should produce
public var foo: PklSwift.TypeAlias
Either unconditionally, or when an outer type would shadow a type from PklSwift.
Output (with compiler errors inlined as comments):
Code generation should produce
Either unconditionally, or when an outer type would shadow a type from
PklSwift.