Skip to content

Typechecker: make utxos affine types #46

@ecioppettini

Description

@ecioppettini

There is an implementation of linear/affine static type checking in the compiler, but utxos are currently not marked as affine types. The reason for this is that the current implementation just counts any usage of a variable, so it's not possible to do something like this:

// a function that doesn't consume the utxo
utxo.get_data();
// change the utxo state
utxo.resume(());

Because the variable will count as used (or moved) on the `get_data. To solve this probably the typechecker needs to check if the function consumes the utxo or not before marking it as used.

Also arguably we should add some sort of tuple syntax before adding more linear type restrictions, since it's quite cumbersome to write code without that.

Metadata

Metadata

Assignees

Labels

languageRelating to language parser and compiler

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions