Documentation
¶
Overview ¶
Package stdlib describes compiler-known portable and platform packages. Definitions are semantic contracts; backends lower their intrinsic IDs to target APIs without leaking those APIs into the TypeRB source language.
Index ¶
- func DirEntryKindType() types.Type
- func DirEntryType() types.Type
- func DirResourceType() types.Type
- func FileModeType() types.Type
- func FileResourceType() types.Type
- func FileSystemErrorKindType() types.Type
- func FileSystemErrorType() types.Type
- func FileSystemTargetType() types.Type
- func IsFileResourceType(typ types.Type) bool
- func IsFilesystemContractType(typ types.Type) bool
- func IsReservedPath(packagePath string) bool
- func IsResourceAcquisition(intrinsic string) bool
- func IsScopedResourceType(typ types.Type) bool
- func IsTrustedResourceContract(definition *Package, symbol *Symbol) bool
- func LookupReceiverMethod(receiver types.Type, name string) (*Package, Symbol, bool)
- func LookupRuntimeExport(name string) (*Package, RuntimeExport, bool)
- func OpaqueType(typ types.Type) bool
- func OpaqueTypeConstructionMessage(typ types.Type) string
- func PathType() types.Type
- func ReceiverMatches(pattern, actual types.Type, typeParameterNames []string) bool
- func RelativePathType() types.Type
- func ResultType(value, failure types.Type) types.Type
- type Block
- type JSXProvider
- type Kind
- type Package
- type Parameter
- type RuntimeExport
- type Symbol
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DirEntryKindType ¶ added in v0.4.3
DirEntryKindType returns the exact standard DirEntryKind declaration.
func DirEntryType ¶ added in v0.4.3
DirEntryType returns the exact standard DirEntry declaration.
func DirResourceType ¶ added in v0.4.4
func FileModeType ¶ added in v0.4.3
FileModeType returns the exact standard FileMode declaration.
func FileResourceType ¶ added in v0.4.3
FileResourceType returns the exact compiler-owned scoped File declaration. Its identity distinguishes host filesystem handles from unrelated public declarations that happen to use the name File.
func FileSystemErrorKindType ¶ added in v0.4.3
FileSystemErrorKindType returns the exact standard FileSystemErrorKind declaration.
func FileSystemErrorType ¶ added in v0.4.3
FileSystemErrorType returns the exact standard FileSystemError declaration.
func FileSystemTargetType ¶ added in v0.4.4
func IsFileResourceType ¶ added in v0.4.3
IsFileResourceType reports whether typ is the standard scoped host File.
func IsFilesystemContractType ¶ added in v0.4.3
IsFilesystemContractType reports whether typ participates in the scoped filesystem contract whose generated runtime references require exact import ownership. Result is included because every filesystem operation crosses that boundary.
func IsReservedPath ¶
func IsResourceAcquisition ¶ added in v0.4.4
func IsScopedResourceType ¶ added in v0.4.4
func IsTrustedResourceContract ¶ added in v0.4.4
IsTrustedResourceContract admits only compiler-owned acquisition origins; copying a descriptor or naming a matching intrinsic cannot mint authority.
func LookupReceiverMethod ¶
func LookupRuntimeExport ¶ added in v0.1.9
func LookupRuntimeExport(name string) (*Package, RuntimeExport, bool)
LookupRuntimeExport returns the compiler-owned package that declares name. Inferred library result types may use these declarations internally, while source annotations still require an explicit import.
func OpaqueType ¶ added in v0.4.3
OpaqueType reports whether an exact compiler-owned package type can only be introduced by that package's checked operations. Declaration identity is required so an unrelated type with the same display name remains ordinary.
func OpaqueTypeConstructionMessage ¶ added in v0.4.3
OpaqueTypeConstructionMessage returns the source-facing diagnostic for an exact compiler-owned type whose values cannot be directly constructed.
func ReceiverMatches ¶ added in v0.2.3
ReceiverMatches reports whether a compiler-known receiver pattern applies to a checked value type. Official packages use the same matching rule as the portable standard library, while remaining unavailable until explicitly imported.
func RelativePathType ¶ added in v0.4.4
RelativePathType returns the validated descendant path's exact declaration.
Types ¶
type Block ¶ added in v0.2.9
type Block struct {
Parameters []types.Type
ControlBoundary bool
Return types.Type
ResultBoundary types.Type
Structured bool
// ScopedParameters marks acquisition-owned resources. Source borrows and
// immutable local aliases preserve that origin; storage, return, native
// escape and retaining callbacks are forbidden by shared checking.
ScopedParameters []bool
}
Block describes the callback accepted by a compiler-owned package function. Structured blocks keep resource and control-flow ownership in the compiler instead of lowering to an ordinary backend callback.
type JSXProvider ¶ added in v0.2.3
JSXProvider declares the node and intrinsic-attribute types contributed by an explicitly imported package. Grammar remains shared while each frontend runtime owns its JSX semantics.
type Package ¶
type Package struct {
Path string
ModulePath string
// Root names the public declaration that owns this package's qualified
// operations. Its members are backed by Symbols but are not themselves
// top-level named exports.
Root string
// BuiltinRoot marks the narrow compiler-owned case where Root is the
// canonical imported static API for an existing built-in type.
BuiltinRoot bool
RuntimeAlias string
RuntimeExports []RuntimeExport
Source string
Kind Kind
Internal bool
Targets map[string]bool
NativeSyntax bool
TypeProvider string
JSX *JSXProvider
Capability bool
// OpaqueTypes are compiler-owned declarations that source code may receive
// or name but cannot construct directly. Each entry provides a
// source-facing construction diagnostic.
OpaqueTypes map[identity.Declaration]string
Symbols map[string]Symbol
}
func PublicPortablePackages ¶ added in v0.3.26
PublicPortablePackages returns public compiler-owned packages that authored source may import in the selected backend mode.
func RuntimeDependenciesForType ¶ added in v0.1.5
RuntimeDependenciesForType returns compiler-owned modules whose runtime declarations are named by a library intrinsic's result type. Source code still needs an explicit import to refer to those declarations directly.
func RuntimeExportPackages ¶ added in v0.2.3
RuntimeExportPackages returns public portable packages that declare source- visible runtime types. Interactive tooling uses this catalog without exposing internal packages or target-specific APIs.
func (*Package) DefaultAlias ¶
type RuntimeExport ¶ added in v0.1.5
type Symbol ¶
type Symbol struct {
Name string
Intrinsic string
// StaticOwner names the class or module that owns this compiler-known
// operation. Unlike Receiver, it represents a static member and does not
// pass the owner declaration as a runtime call argument.
StaticOwner string
// CompilerOnly keeps runner protocol operations out of user imports and
// language-service completion while allowing compiler-owned source to use
// the same checked package boundary.
CompilerOnly bool
// RuntimeIndependent marks an intrinsic that is fully lowered by every
// backend even when its public package also provides a source wrapper.
RuntimeIndependent bool
RequiredSymbols []string
TypeParameters []string
EqualityTypes []types.Type
OrderingTypes []types.Type
Receiver types.Type
ReceiverMutable bool
Parameters []Parameter
Return types.Type
Variadic bool
Inference string
RuntimeDependencies []types.Type
Block *Block
// contains filtered or unexported fields
}
func Instantiate ¶
Instantiate substitutes compiler-owned type parameters inferred from call arguments. The first occurrence fixes a type variable; later occurrences are checked against that substitution by the ordinary checker.
func ReceiverMethods ¶ added in v0.1.6
ReceiverMethods returns the portable receiver methods available for a checked type. Language tooling uses the same contracts as the checker so completion cannot advertise target-native or otherwise invalid members.