sol_types 0.1.0+1 copy "sol_types: ^0.1.0+1" to clipboard
sol_types: ^0.1.0+1 copied to clipboard

Solidity type system for the sol_pkgs compiler. Defines the runtime type lattice, implicit/explicit conversions, and mutability.

sol_types #

Solidity type system for the sol_pkgs compiler.

Defines the runtime type lattice used by sol_sema (type checking) and sol_abi (ABI encoding).

Type hierarchy #

SolType
├── IntType          (int8…int256, uint8…uint256)
├── BoolType
├── AddressType      (address, address payable)
├── BytesNType       (bytes1…bytes32)
├── BytesType        (bytes — dynamic)
├── StringType       (string — dynamic)
├── ArrayType        (T[N] fixed, T[] dynamic)
├── MappingType      (mapping(K => V))
├── TupleType        (anonymous struct / multi-return)
├── FunctionType     (internal / external)
├── TypeType         (type(X) expressions)
└── ErrorType        (sentinel for unresolved types)

Key functions #

Function Description
isImplicitlyConvertible(from, to) Widening / covariance rules
isExplicitlyConvertible(from, to) Cast rules
commonType(a, b) Least upper bound for binary ops

Usage #

import 'package:sol_types/sol_types.dart';

void main() {
  const a = IntType(8, signed: false);   // uint8
  const b = IntType(256, signed: false); // uint256
  print(isImplicitlyConvertible(a, b)); // true
  print(commonType(a, b));              // uint256
}

Dependencies #

  • sol_support — foundation (no type-level dep, but shares diagnostics pattern)
0
likes
150
points
107
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Solidity type system for the sol_pkgs compiler. Defines the runtime type lattice, implicit/explicit conversions, and mutability.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

sol_support

More

Packages that depend on sol_types