sun::types::TypeParameterType

sun::types::TypeParameterType

class · Source (opens in a new tab)

class sun::types::TypeParameterType : public sun::types::Type

Type parameter (used in generic class/function definitions) Represents a type variable like T, U, V in class List<T>.

Inherits

Public Functions

TypeParameterType

public · function · Source (opens in a new tab)

sun::types::TypeParameterType::TypeParameterType(std::string paramName, TypeConstraint constraint={}, TypeProjection projection=TypeProjection::None, DeclarationId declaration={}, std::shared_ptr< const int > session={})

Creates a generic type parameter retaining its constraint and declaration identity.

Related: TypeConstraint, TypeProjection, TypeProjection::None, DeclarationId

equals

public · function · Source (opens in a new tab)

bool sun::types::TypeParameterType::equals(const Type &other) const override

Reports whether the other type has the same semantic identity.

Related: Type

getConstraint

public · function · Source (opens in a new tab)

const TypeConstraint & sun::types::TypeParameterType::getConstraint() const

The complete requirement carried by this parameter.

Related: TypeConstraint

getKind

public · function · Source (opens in a new tab)

Kind sun::types::TypeParameterType::getKind() const override

Returns the type category used for semantic checks and dispatch.

Related: Kind

getName

public · function · Source (opens in a new tab)

const std::string & sun::types::TypeParameterType::getName() const

Returns the declared name used to identify this object.

getProjection

public · function · Source (opens in a new tab)

TypeProjection sun::types::TypeParameterType::getProjection() const

Returns the projection stored by this object.

Related: TypeProjection

getProjectionBase

public · function · Source (opens in a new tab)

const std::string & sun::types::TypeParameterType::getProjectionBase() const

Returns the projection base stored by this object.

hasConstraint

public · function · Source (opens in a new tab)

bool sun::types::TypeParameterType::hasConstraint() const

Reports whether this object has constraint.

project

public · function · Source (opens in a new tab)

TypePtr sun::types::TypeParameterType::project(TypeProjection projection) const

Retain the binder identity when projecting its eventual concrete type.

Related: TypePtr, TypeProjection

toDisplayString

public · function · Source (opens in a new tab)

std::string sun::types::TypeParameterType::toDisplayString() const override

Returns a source-facing type name without internal compiler prefixes.

toLLVMType

public · function · Source (opens in a new tab)

llvm::Type * sun::types::TypeParameterType::toLLVMType(llvm::LLVMContext &ctx) const override

Type parameters can't be directly converted to LLVM types They must be substituted first.

Related: Type

toString

public · function · Source (opens in a new tab)

std::string sun::types::TypeParameterType::toString() const override

Returns a readable representation for diagnostics and debugging.

Public Fields

StaticKind

public · variable · static · Source (opens in a new tab)

Kind sun::types::TypeParameterType::StaticKind = Kind::TypeParameter

No documentation comment.

Related: Kind, Kind::TypeParameter

Private Fields

base_

private · variable · Source (opens in a new tab)

std::string sun::types::TypeParameterType::base_

No documentation comment.

constraint_

private · variable · Source (opens in a new tab)

TypeConstraint sun::types::TypeParameterType::constraint_

No documentation comment.

Related: TypeConstraint

declaration_

private · variable · Source (opens in a new tab)

DeclarationId sun::types::TypeParameterType::declaration_

No documentation comment.

Related: DeclarationId

name

private · variable · Source (opens in a new tab)

std::string sun::types::TypeParameterType::name

No documentation comment.

projection_

private · variable · Source (opens in a new tab)

TypeProjection sun::types::TypeParameterType::projection_ = TypeProjection::None

No documentation comment.

Related: TypeProjection, TypeProjection::None

session_

private · variable · Source (opens in a new tab)

std::shared_ptr<const int> sun::types::TypeParameterType::session_

No documentation comment.