merge testnet3

This commit is contained in:
collin 2022-06-22 21:42:00 -10:00
commit 7417496eee
452 changed files with 2936 additions and 3190 deletions

18
Cargo.lock generated
View File

@ -381,9 +381,9 @@ dependencies = [
[[package]] [[package]]
name = "clap" name = "clap"
version = "3.2.5" version = "3.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d53da17d37dba964b9b3ecb5c5a1f193a2762c700e6829201e645b9381c99dc7" checksum = "9f1fe12880bae935d142c8702d500c63a4e8634b6c3c57ad72bf978fc7b6249a"
dependencies = [ dependencies = [
"atty", "atty",
"bitflags", "bitflags",
@ -398,9 +398,9 @@ dependencies = [
[[package]] [[package]]
name = "clap_derive" name = "clap_derive"
version = "3.2.5" version = "3.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c11d40217d16aee8508cc8e5fde8b4ff24639758608e5374e731b53f85749fb9" checksum = "ed6db9e867166a43a53f7199b5e4d1f522a1e5bd626654be263c999ce59df39a"
dependencies = [ dependencies = [
"heck", "heck",
"proc-macro-error", "proc-macro-error",
@ -1020,9 +1020,9 @@ dependencies = [
[[package]] [[package]]
name = "indexmap" name = "indexmap"
version = "1.9.0" version = "1.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c6392766afd7964e2531940894cffe4bd8d7d17dbc3c1c4857040fd4b33bdb3" checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"hashbrown", "hashbrown",
@ -1167,7 +1167,7 @@ dependencies = [
"ansi_term", "ansi_term",
"assert_cmd", "assert_cmd",
"backtrace", "backtrace",
"clap 3.2.5", "clap 3.2.6",
"color-backtrace", "color-backtrace",
"colored", "colored",
"console", "console",
@ -1210,7 +1210,7 @@ dependencies = [
name = "leo-parser" name = "leo-parser"
version = "1.5.3" version = "1.5.3"
dependencies = [ dependencies = [
"clap 3.2.5", "clap 3.2.6",
"indexmap", "indexmap",
"lazy_static", "lazy_static",
"leo-ast", "leo-ast",
@ -1252,7 +1252,7 @@ name = "leo-test-framework"
version = "1.5.3" version = "1.5.3"
dependencies = [ dependencies = [
"backtrace", "backtrace",
"clap 3.2.5", "clap 3.2.6",
"criterion", "criterion",
"leo-compiler", "leo-compiler",
"leo-errors", "leo-errors",

View File

@ -58,7 +58,7 @@ rev = "51633e2"
version = "0.3.65" version = "0.3.65"
[dependencies.clap] [dependencies.clap]
version = "3.2.1" version = "3.2.6"
features = ["derive", "env"] features = ["derive", "env"]
[dependencies.color-backtrace] [dependencies.color-backtrace]

View File

@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>. // along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
use crate::{GroupValue, Identifier, IntegerType, Node}; use crate::{Identifier, IntegerType, Node};
use leo_span::Span; use leo_span::Span;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -49,6 +49,10 @@ pub use value::*;
pub enum Expression { pub enum Expression {
/// A circuit access expression, e.g., `Foo.bar`. /// A circuit access expression, e.g., `Foo.bar`.
Access(AccessExpression), Access(AccessExpression),
/// An identifier expression.
Identifier(Identifier),
/// A literal expression.
Literal(LiteralExpression),
/// A binary expression, e.g., `42 + 24`. /// A binary expression, e.g., `42 + 24`.
Binary(BinaryExpression), Binary(BinaryExpression),
/// A call expression, e.g., `my_fun(args)`. /// A call expression, e.g., `my_fun(args)`.
@ -58,14 +62,10 @@ pub enum Expression {
/// An expression of type "error". /// An expression of type "error".
/// Will result in a compile error eventually. /// Will result in a compile error eventually.
Err(ErrExpression), Err(ErrExpression),
/// An identifier expression.
Identifier(Identifier),
/// A ternary conditional expression `cond ? if_expr : else_expr`. /// A ternary conditional expression `cond ? if_expr : else_expr`.
Ternary(TernaryExpression), Ternary(TernaryExpression),
/// An unary expression. /// An unary expression.
Unary(UnaryExpression), Unary(UnaryExpression),
/// A literal expression.
Value(ValueExpression),
} }
impl Node for Expression { impl Node for Expression {
@ -73,14 +73,14 @@ impl Node for Expression {
use Expression::*; use Expression::*;
match self { match self {
Access(n) => n.span(), Access(n) => n.span(),
Identifier(n) => n.span(),
Literal(n) => n.span(),
Binary(n) => n.span(), Binary(n) => n.span(),
Call(n) => n.span(), Call(n) => n.span(),
CircuitInit(n) => n.span(), CircuitInit(n) => n.span(),
Err(n) => n.span(), Err(n) => n.span(),
Identifier(n) => n.span(),
Ternary(n) => n.span(), Ternary(n) => n.span(),
Unary(n) => n.span(), Unary(n) => n.span(),
Value(n) => n.span(),
} }
} }
@ -88,14 +88,14 @@ impl Node for Expression {
use Expression::*; use Expression::*;
match self { match self {
Access(n) => n.set_span(span), Access(n) => n.set_span(span),
Identifier(n) => n.set_span(span),
Literal(n) => n.set_span(span),
Binary(n) => n.set_span(span), Binary(n) => n.set_span(span),
Call(n) => n.set_span(span), Call(n) => n.set_span(span),
CircuitInit(n) => n.set_span(span), CircuitInit(n) => n.set_span(span),
Err(n) => n.set_span(span), Err(n) => n.set_span(span),
Identifier(n) => n.set_span(span),
Ternary(n) => n.set_span(span), Ternary(n) => n.set_span(span),
Unary(n) => n.set_span(span), Unary(n) => n.set_span(span),
Value(n) => n.set_span(span),
} }
} }
} }
@ -105,14 +105,14 @@ impl fmt::Display for Expression {
use Expression::*; use Expression::*;
match &self { match &self {
Access(n) => n.fmt(f), Access(n) => n.fmt(f),
Identifier(n) => n.fmt(f),
Literal(n) => n.fmt(f),
Binary(n) => n.fmt(f), Binary(n) => n.fmt(f),
Call(n) => n.fmt(f), Call(n) => n.fmt(f),
CircuitInit(n) => n.fmt(f), CircuitInit(n) => n.fmt(f),
Err(n) => n.fmt(f), Err(n) => n.fmt(f),
Identifier(n) => n.fmt(f),
Ternary(n) => n.fmt(f), Ternary(n) => n.fmt(f),
Unary(n) => n.fmt(f), Unary(n) => n.fmt(f),
Value(n) => n.fmt(f),
} }
} }
} }

View File

@ -14,22 +14,24 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>. // along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
use crate::GroupLiteral;
use super::*; use super::*;
/// A literal expression. /// A literal expression.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum ValueExpression { pub enum LiteralExpression {
// todo: deserialize values here // todo: deserialize values here
/// An address literal, e.g., `aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8s7pyjh9`. /// An address literal, e.g., `aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8s7pyjh9`.
Address(String, #[serde(with = "leo_span::span_json")] Span), Address(String, #[serde(with = "leo_span::span_json")] Span),
/// A boolean literal, either `true` or `false`. /// A boolean literal, either `true` or `false`.
Boolean(String, #[serde(with = "leo_span::span_json")] Span), Boolean(bool, #[serde(with = "leo_span::span_json")] Span),
/// A field literal, e.g., `42field`. /// A field literal, e.g., `42field`.
/// A signed number followed by the keyword `field`. /// A signed number followed by the keyword `field`.
Field(String, #[serde(with = "leo_span::span_json")] Span), Field(String, #[serde(with = "leo_span::span_json")] Span),
/// A group literal, either product or affine. /// A group literal, either product or affine.
/// For example, `42group` or `(12, 52)group`. /// For example, `42group` or `(12, 52)group`.
Group(Box<GroupValue>), Group(Box<GroupLiteral>),
/// An integer literal, e.g., `42`. /// An integer literal, e.g., `42`.
Integer(IntegerType, String, #[serde(with = "leo_span::span_json")] Span), Integer(IntegerType, String, #[serde(with = "leo_span::span_json")] Span),
/// A scalar literal, e.g. `1scalar`. /// A scalar literal, e.g. `1scalar`.
@ -39,50 +41,47 @@ pub enum ValueExpression {
String(String, #[serde(with = "leo_span::span_json")] Span), String(String, #[serde(with = "leo_span::span_json")] Span),
} }
impl fmt::Display for ValueExpression { impl fmt::Display for LiteralExpression {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
use ValueExpression::*;
match &self { match &self {
Address(address, _) => write!(f, "{}", address), Self::Address(address, _) => write!(f, "{}", address),
Boolean(boolean, _) => write!(f, "{}", boolean), Self::Boolean(boolean, _) => write!(f, "{}", boolean),
Field(field, _) => write!(f, "{}", field), Self::Field(field, _) => write!(f, "{}", field),
Group(group) => write!(f, "{}", group), Self::Group(group) => write!(f, "{}", group),
Integer(type_, value, _) => write!(f, "{}{}", value, type_), Self::Integer(type_, value, _) => write!(f, "{}{}", value, type_),
Scalar(scalar, _) => write!(f, "{}", scalar), Self::Scalar(scalar, _) => write!(f, "{}", scalar),
String(string, _) => write!(f, "{}", string), Self::String(string, _) => write!(f, "{}", string),
} }
} }
} }
impl Node for ValueExpression { impl Node for LiteralExpression {
fn span(&self) -> Span { fn span(&self) -> Span {
use ValueExpression::*;
match &self { match &self {
Address(_, span) Self::Address(_, span)
| Boolean(_, span) | Self::Boolean(_, span)
| Field(_, span) | Self::Field(_, span)
| Integer(_, _, span) | Self::Integer(_, _, span)
| Scalar(_, span) | Self::Scalar(_, span)
| String(_, span) => *span, | Self::String(_, span) => *span,
Group(group) => match &**group { Self::Group(group) => match &**group {
GroupValue::Single(_, span) => *span, GroupLiteral::Single(_, span) => *span,
GroupValue::Tuple(tuple) => tuple.span, GroupLiteral::Tuple(tuple) => tuple.span,
}, },
} }
} }
fn set_span(&mut self, new_span: Span) { fn set_span(&mut self, new_span: Span) {
use ValueExpression::*;
match self { match self {
Address(_, span) Self::Address(_, span)
| Boolean(_, span) | Self::Boolean(_, span)
| Field(_, span) | Self::Field(_, span)
| Integer(_, _, span) | Self::Integer(_, _, span)
| Scalar(_, span) | Self::Scalar(_, span)
| String(_, span) => *span = new_span, | Self::String(_, span) => *span = new_span,
Group(group) => match &mut **group { Self::Group(group) => match &mut **group {
GroupValue::Single(_, span) => *span = new_span, GroupLiteral::Single(_, span) => *span = new_span,
GroupValue::Tuple(tuple) => tuple.span = new_span, GroupLiteral::Tuple(tuple) => tuple.span = new_span,
}, },
} }
} }

View File

@ -22,34 +22,34 @@ use std::fmt;
/// A group literal. /// A group literal.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum GroupValue { pub enum GroupLiteral {
/// Product group literal, e.g., `42group`. /// Product group literal, e.g., `42group`.
Single(String, #[serde(with = "leo_span::span_json")] Span), Single(String, #[serde(with = "leo_span::span_json")] Span),
/// An affine group literal with (x, y) coordinates. /// An affine group literal with (x, y) coordinates.
Tuple(GroupTuple), Tuple(GroupTuple),
} }
impl GroupValue { impl GroupLiteral {
pub fn set_span(&mut self, new_span: Span) { pub fn set_span(&mut self, new_span: Span) {
match self { match self {
GroupValue::Single(_, old_span) => *old_span = new_span, Self::Single(_, old_span) => *old_span = new_span,
GroupValue::Tuple(tuple) => tuple.span = new_span, Self::Tuple(tuple) => tuple.span = new_span,
} }
} }
pub fn span(&self) -> &Span { pub fn span(&self) -> &Span {
match self { match self {
GroupValue::Single(_, span) => span, Self::Single(_, span) => span,
GroupValue::Tuple(tuple) => &tuple.span, Self::Tuple(tuple) => &tuple.span,
} }
} }
} }
impl fmt::Display for GroupValue { impl fmt::Display for GroupLiteral {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self { match self {
GroupValue::Single(string, _) => write!(f, "{}", string), Self::Single(string, _) => write!(f, "{}", string),
GroupValue::Tuple(tuple) => write!(f, "{}", tuple), Self::Tuple(tuple) => write!(f, "{}", tuple),
} }
} }
} }

View File

@ -17,5 +17,5 @@
pub mod group_coordinate; pub mod group_coordinate;
pub use self::group_coordinate::*; pub use self::group_coordinate::*;
pub mod group_value; pub mod group_literal;
pub use self::group_value::*; pub use self::group_literal::*;

View File

@ -14,8 +14,8 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>. // along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
use crate::{Expression, GroupValue, IntegerType, Node, Type, UnaryOperation, ValueExpression}; use crate::{Expression, GroupLiteral, IntegerType, LiteralExpression, Node, Type, UnaryOperation};
use leo_errors::{InputError, LeoError, ParserError, Result}; use leo_errors::{InputError, LeoError, Result};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::fmt; use std::fmt;
@ -25,7 +25,7 @@ pub enum InputValue {
Address(String), Address(String),
Boolean(bool), Boolean(bool),
Field(String), Field(String),
Group(GroupValue), Group(GroupLiteral),
Integer(IntegerType, String), Integer(IntegerType, String),
} }
@ -33,16 +33,12 @@ impl TryFrom<(Type, Expression)> for InputValue {
type Error = LeoError; type Error = LeoError;
fn try_from(value: (Type, Expression)) -> Result<Self> { fn try_from(value: (Type, Expression)) -> Result<Self> {
Ok(match value { Ok(match value {
(type_, Expression::Value(value)) => { (type_, Expression::Literal(lit)) => match (type_, lit) {
match (type_, value) { (Type::Address, LiteralExpression::Address(value, _)) => Self::Address(value),
(Type::Address, ValueExpression::Address(value, _)) => Self::Address(value), (Type::Boolean, LiteralExpression::Boolean(value, _)) => Self::Boolean(value),
(Type::Boolean, ValueExpression::Boolean(value, span)) => { (Type::Field, LiteralExpression::Field(value, _)) => Self::Field(value),
let bool_value = value.parse::<bool>().map_err(|_| ParserError::unexpected_eof(span))?; // TODO: change error (Type::Group, LiteralExpression::Group(value)) => Self::Group(*value),
Self::Boolean(bool_value) (Type::IntegerType(expected), LiteralExpression::Integer(actual, value, span)) => {
}
(Type::Field, ValueExpression::Field(value, _)) => Self::Field(value),
(Type::Group, ValueExpression::Group(value)) => Self::Group(*value),
(Type::IntegerType(expected), ValueExpression::Integer(actual, value, span)) => {
if expected == actual { if expected == actual {
Self::Integer(expected, value) Self::Integer(expected, value)
} else { } else {
@ -52,8 +48,7 @@ impl TryFrom<(Type, Expression)> for InputValue {
(x, y) => { (x, y) => {
return Err(InputError::unexpected_type(x, &y, y.span()).into()); return Err(InputError::unexpected_type(x, &y, y.span()).into());
} }
} },
}
(type_, Expression::Unary(unary)) if unary.op == UnaryOperation::Negate => { (type_, Expression::Unary(unary)) if unary.op == UnaryOperation::Negate => {
InputValue::try_from((type_, *unary.receiver))? InputValue::try_from((type_, *unary.receiver))?
} }

View File

@ -41,7 +41,7 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
pub fn reduce_expression(&mut self, expression: &Expression) -> Result<Expression> { pub fn reduce_expression(&mut self, expression: &Expression) -> Result<Expression> {
let new = match expression { let new = match expression {
Expression::Identifier(identifier) => Expression::Identifier(self.reduce_identifier(identifier)?), Expression::Identifier(identifier) => Expression::Identifier(self.reduce_identifier(identifier)?),
Expression::Value(value) => self.reduce_value(value)?, Expression::Literal(lit) => self.reduce_literal(lit)?,
Expression::Binary(binary) => Expression::Binary(self.reduce_binary(binary)?), Expression::Binary(binary) => Expression::Binary(self.reduce_binary(binary)?),
Expression::Unary(unary) => Expression::Unary(self.reduce_unary(unary)?), Expression::Unary(unary) => Expression::Unary(self.reduce_unary(unary)?),
Expression::Ternary(ternary) => Expression::Ternary(self.reduce_ternary(ternary)?), Expression::Ternary(ternary) => Expression::Ternary(self.reduce_ternary(ternary)?),
@ -61,29 +61,29 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
self.reducer.reduce_group_tuple(group_tuple) self.reducer.reduce_group_tuple(group_tuple)
} }
pub fn reduce_group_value(&mut self, group_value: &GroupValue) -> Result<GroupValue> { pub fn reduce_group_literal(&mut self, group_lit: &GroupLiteral) -> Result<GroupLiteral> {
let new = match group_value { let new = match group_lit {
GroupValue::Tuple(group_tuple) => GroupValue::Tuple(self.reduce_group_tuple(group_tuple)?), GroupLiteral::Tuple(group_tuple) => GroupLiteral::Tuple(self.reduce_group_tuple(group_tuple)?),
_ => group_value.clone(), _ => group_lit.clone(),
}; };
self.reducer.reduce_group_value(group_value, new) self.reducer.reduce_group_literal(group_lit, new)
} }
pub fn reduce_string(&mut self, string: &str, span: &Span) -> Result<Expression> { pub fn reduce_string(&mut self, string: &str, span: &Span) -> Result<Expression> {
self.reducer.reduce_string(string, span) self.reducer.reduce_string(string, span)
} }
pub fn reduce_value(&mut self, value: &ValueExpression) -> Result<Expression> { pub fn reduce_literal(&mut self, lit: &LiteralExpression) -> Result<Expression> {
let new = match value { let new = match lit {
ValueExpression::Group(group_value) => { LiteralExpression::Group(group_value) => Expression::Literal(LiteralExpression::Group(Box::new(
Expression::Value(ValueExpression::Group(Box::new(self.reduce_group_value(group_value)?))) self.reduce_group_literal(group_value)?,
} ))),
ValueExpression::String(string, span) => self.reduce_string(string, span)?, LiteralExpression::String(string, span) => self.reduce_string(string, span)?,
_ => Expression::Value(value.clone()), _ => Expression::Literal(lit.clone()),
}; };
self.reducer.reduce_value(value, new) self.reducer.reduce_literal(lit, new)
} }
pub fn reduce_binary(&mut self, binary: &BinaryExpression) -> Result<BinaryExpression> { pub fn reduce_binary(&mut self, binary: &BinaryExpression) -> Result<BinaryExpression> {
@ -158,38 +158,11 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
self.reducer.reduce_definition(definition, variable_names, type_, value) self.reducer.reduce_definition(definition, variable_names, type_, value)
} }
pub fn reduce_assignee_access(&mut self, access: &AssigneeAccess) -> Result<AssigneeAccess> {
let new = match access {
AssigneeAccess::ArrayRange(left, right) => {
let left = left.as_ref().map(|left| self.reduce_expression(left)).transpose()?;
let right = right.as_ref().map(|right| self.reduce_expression(right)).transpose()?;
AssigneeAccess::ArrayRange(left, right)
}
AssigneeAccess::ArrayIndex(index) => AssigneeAccess::ArrayIndex(self.reduce_expression(index)?),
AssigneeAccess::Member(identifier) => AssigneeAccess::Member(self.reduce_identifier(identifier)?),
_ => access.clone(),
};
self.reducer.reduce_assignee_access(access, new)
}
pub fn reduce_assignee(&mut self, assignee: &Assignee) -> Result<Assignee> {
let identifier = self.reduce_identifier(&assignee.identifier)?;
let mut accesses = vec![];
for access in assignee.accesses.iter() {
accesses.push(self.reduce_assignee_access(access)?);
}
self.reducer.reduce_assignee(assignee, identifier, accesses)
}
pub fn reduce_assign(&mut self, assign: &AssignStatement) -> Result<AssignStatement> { pub fn reduce_assign(&mut self, assign: &AssignStatement) -> Result<AssignStatement> {
let assignee = self.reduce_assignee(&assign.assignee)?; let place = self.reduce_expression(&assign.place)?;
let value = self.reduce_expression(&assign.value)?; let value = self.reduce_expression(&assign.value)?;
self.reducer.reduce_assign(assign, assignee, value) self.reducer.reduce_assign(assign, place, value)
} }
pub fn reduce_conditional(&mut self, conditional: &ConditionalStatement) -> Result<ConditionalStatement> { pub fn reduce_conditional(&mut self, conditional: &ConditionalStatement) -> Result<ConditionalStatement> {

View File

@ -55,15 +55,18 @@ pub trait ReconstructingReducer {
}) })
} }
fn reduce_group_value(&mut self, _group_value: &GroupValue, new: GroupValue) -> Result<GroupValue> { fn reduce_group_literal(&mut self, _group_lit: &GroupLiteral, new: GroupLiteral) -> Result<GroupLiteral> {
Ok(new) Ok(new)
} }
fn reduce_string(&mut self, string: &str, span: &Span) -> Result<Expression> { fn reduce_string(&mut self, string: &str, span: &Span) -> Result<Expression> {
Ok(Expression::Value(ValueExpression::String(string.to_string(), *span))) Ok(Expression::Literal(LiteralExpression::String(
string.to_string(),
*span,
)))
} }
fn reduce_value(&mut self, _value: &ValueExpression, new: Expression) -> Result<Expression> { fn reduce_literal(&mut self, _lit: &LiteralExpression, new: Expression) -> Result<Expression> {
Ok(new) Ok(new)
} }
@ -159,32 +162,15 @@ pub trait ReconstructingReducer {
}) })
} }
fn reduce_assignee_access(&mut self, _access: &AssigneeAccess, new: AssigneeAccess) -> Result<AssigneeAccess> {
Ok(new)
}
fn reduce_assignee(
&mut self,
assignee: &Assignee,
identifier: Identifier,
accesses: Vec<AssigneeAccess>,
) -> Result<Assignee> {
Ok(Assignee {
identifier,
accesses,
span: assignee.span,
})
}
fn reduce_assign( fn reduce_assign(
&mut self, &mut self,
assign: &AssignStatement, assign: &AssignStatement,
assignee: Assignee, place: Expression,
value: Expression, value: Expression,
) -> Result<AssignStatement> { ) -> Result<AssignStatement> {
Ok(AssignStatement { Ok(AssignStatement {
operation: assign.operation, operation: assign.operation,
assignee, place,
value, value,
span: assign.span, span: assign.span,
}) })

View File

@ -42,6 +42,10 @@ pub trait ExpressionVisitor<'a> {
Default::default() Default::default()
} }
fn visit_literal(&mut self, _input: &'a LiteralExpression) -> VisitResult {
Default::default()
}
fn visit_call(&mut self, _input: &'a CallExpression) -> VisitResult { fn visit_call(&mut self, _input: &'a CallExpression) -> VisitResult {
Default::default() Default::default()
} }
@ -65,10 +69,6 @@ pub trait ExpressionVisitor<'a> {
fn visit_unary(&mut self, _input: &'a UnaryExpression) -> VisitResult { fn visit_unary(&mut self, _input: &'a UnaryExpression) -> VisitResult {
Default::default() Default::default()
} }
fn visit_value(&mut self, _input: &'a ValueExpression) -> VisitResult {
Default::default()
}
} }
pub trait StatementVisitor<'a> { pub trait StatementVisitor<'a> {

View File

@ -36,14 +36,14 @@ pub trait ExpressionVisitorDirector<'a>: VisitorDirector<'a> {
if let VisitResult::VisitChildren = self.visitor_ref().visit_expression(input) { if let VisitResult::VisitChildren = self.visitor_ref().visit_expression(input) {
match input { match input {
Expression::Access(expr) => self.visit_access(expr, additional), Expression::Access(expr) => self.visit_access(expr, additional),
Expression::Identifier(expr) => self.visit_identifier(expr, additional),
Expression::Literal(expr) => self.visit_literal(expr, additional),
Expression::Binary(expr) => self.visit_binary(expr, additional), Expression::Binary(expr) => self.visit_binary(expr, additional),
Expression::Call(expr) => self.visit_call(expr, additional), Expression::Call(expr) => self.visit_call(expr, additional),
Expression::CircuitInit(expr) => self.visit_circuit_init(expr, additional), Expression::CircuitInit(expr) => self.visit_circuit_init(expr, additional),
Expression::Err(expr) => self.visit_err(expr, additional), Expression::Err(expr) => self.visit_err(expr, additional),
Expression::Identifier(expr) => self.visit_identifier(expr, additional),
Expression::Ternary(expr) => self.visit_ternary(expr, additional), Expression::Ternary(expr) => self.visit_ternary(expr, additional),
Expression::Unary(expr) => self.visit_unary(expr, additional), Expression::Unary(expr) => self.visit_unary(expr, additional),
Expression::Value(expr) => self.visit_value(expr, additional),
}; };
} }
@ -55,8 +55,12 @@ pub trait ExpressionVisitorDirector<'a>: VisitorDirector<'a> {
None None
} }
fn visit_value(&mut self, input: &'a ValueExpression, _additional: &Self::AdditionalInput) -> Option<Self::Output> { fn visit_literal(
self.visitor_ref().visit_value(input); &mut self,
input: &'a LiteralExpression,
_additional: &Self::AdditionalInput,
) -> Option<Self::Output> {
self.visitor_ref().visit_literal(input);
None None
} }

View File

@ -1,72 +0,0 @@
// Copyright (C) 2019-2022 Aleo Systems Inc.
// This file is part of the Leo library.
// The Leo library is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// The Leo library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
use crate::{Expression, Identifier, PositiveNumber};
use leo_span::Span;
use serde::{Deserialize, Serialize};
use std::fmt;
#[allow(clippy::large_enum_variant)]
/// A sub-place in a variable to assign to.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum AssigneeAccess {
/// Assignment to a range in an array.
ArrayRange(Option<Expression>, Option<Expression>),
/// Assignment to an element of an array identified by its index.
ArrayIndex(Expression),
/// Assignment to a tuple field by its position, e.g., `2`.
Tuple(PositiveNumber, #[serde(with = "leo_span::span_json")] Span),
/// Assignment to a field in a structure.
Member(Identifier),
}
/// Definition assignee, e.g., `v`, `arr[0..2]`, `p.x`.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct Assignee {
/// The base variable to assign to.
pub identifier: Identifier,
/// Sub-places within `identifier` to assign to, if any.
pub accesses: Vec<AssigneeAccess>,
pub span: Span,
}
impl Assignee {
/// Returns the name of the variable being assigned to.
pub fn identifier(&self) -> &Identifier {
&self.identifier
}
}
impl fmt::Display for Assignee {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.identifier)?;
for access in &self.accesses {
match access {
AssigneeAccess::ArrayRange(Some(left), Some(right)) => write!(f, "[{}..{}]", left, right)?,
AssigneeAccess::ArrayRange(None, Some(right)) => write!(f, "[..{}]", right)?,
AssigneeAccess::ArrayRange(Some(left), None) => write!(f, "[{}..]", left)?,
AssigneeAccess::ArrayRange(None, None) => write!(f, "[..]")?,
AssigneeAccess::ArrayIndex(index) => write!(f, "[{}]", index)?,
AssigneeAccess::Tuple(index, _span) => write!(f, ".{}", index)?,
AssigneeAccess::Member(member) => write!(f, ".{}", member)?,
}
}
write!(f, "")
}
}

View File

@ -20,9 +20,6 @@ use leo_span::Span;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::fmt; use std::fmt;
mod assignee;
pub use assignee::*;
/// The assignment operator. /// The assignment operator.
#[derive(Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Debug)] #[derive(Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Debug)]
pub enum AssignOperation { pub enum AssignOperation {
@ -87,7 +84,7 @@ pub struct AssignStatement {
/// For plain assignment, use `AssignOperation::Assign`. /// For plain assignment, use `AssignOperation::Assign`.
pub operation: AssignOperation, pub operation: AssignOperation,
/// The place to assign to. /// The place to assign to.
pub assignee: Assignee, pub place: Expression,
/// The value to assign to the `assignee`. /// The value to assign to the `assignee`.
pub value: Expression, pub value: Expression,
/// The span, excluding the semicolon. /// The span, excluding the semicolon.
@ -96,7 +93,7 @@ pub struct AssignStatement {
impl fmt::Display for AssignStatement { impl fmt::Display for AssignStatement {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{} {} {};", self.assignee, self.operation.as_ref(), self.value) write!(f, "{} {} {};", self.place, self.operation.as_ref(), self.value)
} }
} }

View File

@ -15,10 +15,11 @@
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>. // along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
use super::*; use super::*;
use leo_errors::{ParserError, Result}; use leo_errors::{ParserError, Result};
use leo_span::sym; use leo_span::sym;
use snarkvm_dpc::{prelude::Address, testnet2::Testnet2};
const INT_TYPES: &[Token] = &[ const INT_TYPES: &[Token] = &[
Token::I8, Token::I8,
Token::I16, Token::I16,
@ -374,9 +375,9 @@ impl ParserContext<'_> {
/// tuple initialization expression or an affine group literal. /// tuple initialization expression or an affine group literal.
fn parse_tuple_expression(&mut self) -> Result<Expression> { fn parse_tuple_expression(&mut self) -> Result<Expression> {
if let Some(gt) = self.eat_group_partial().transpose()? { if let Some(gt) = self.eat_group_partial().transpose()? {
return Ok(Expression::Value(ValueExpression::Group(Box::new(GroupValue::Tuple( return Ok(Expression::Literal(LiteralExpression::Group(Box::new(
gt, GroupLiteral::Tuple(gt),
))))); ))));
} }
let (mut tuple, trailing, span) = self.parse_expr_tuple()?; let (mut tuple, trailing, span) = self.parse_expr_tuple()?;
@ -501,31 +502,38 @@ impl ParserContext<'_> {
// Literal followed by `field`, e.g., `42field`. // Literal followed by `field`, e.g., `42field`.
Some(Token::Field) => { Some(Token::Field) => {
assert_no_whitespace("field")?; assert_no_whitespace("field")?;
Expression::Value(ValueExpression::Field(value, full_span)) Expression::Literal(LiteralExpression::Field(value, full_span))
} }
// Literal followed by `group`, e.g., `42group`. // Literal followed by `group`, e.g., `42group`.
Some(Token::Group) => { Some(Token::Group) => {
assert_no_whitespace("group")?; assert_no_whitespace("group")?;
Expression::Value(ValueExpression::Group(Box::new(GroupValue::Single(value, full_span)))) Expression::Literal(LiteralExpression::Group(Box::new(GroupLiteral::Single(
value, full_span,
))))
} }
// Literal followed by `scalar` e.g., `42scalar`. // Literal followed by `scalar` e.g., `42scalar`.
Some(Token::Scalar) => { Some(Token::Scalar) => {
assert_no_whitespace("scalar")?; assert_no_whitespace("scalar")?;
Expression::Value(ValueExpression::Scalar(value, full_span)) Expression::Literal(LiteralExpression::Scalar(value, full_span))
} }
// Literal followed by other type suffix, e.g., `42u8`. // Literal followed by other type suffix, e.g., `42u8`.
Some(suffix) => { Some(suffix) => {
assert_no_whitespace(&suffix.to_string())?; assert_no_whitespace(&suffix.to_string())?;
let int_ty = Self::token_to_int_type(suffix).expect("unknown int type token"); let int_ty = Self::token_to_int_type(suffix).expect("unknown int type token");
Expression::Value(ValueExpression::Integer(int_ty, value, full_span)) Expression::Literal(LiteralExpression::Integer(int_ty, value, full_span))
} }
None => return Err(ParserError::implicit_values_not_allowed(value, span).into()), None => return Err(ParserError::implicit_values_not_allowed(value, span).into()),
} }
} }
Token::True => Expression::Value(ValueExpression::Boolean("true".into(), span)), Token::True => Expression::Literal(LiteralExpression::Boolean(true, span)),
Token::False => Expression::Value(ValueExpression::Boolean("false".into(), span)), Token::False => Expression::Literal(LiteralExpression::Boolean(false, span)),
Token::AddressLit(value) => Expression::Value(ValueExpression::Address(value, span)), Token::AddressLit(addr) => {
Token::StaticString(value) => Expression::Value(ValueExpression::String(value, span)), if addr.parse::<Address<Testnet2>>().is_err() {
self.emit_err(ParserError::invalid_address_lit(&addr, span));
}
Expression::Literal(LiteralExpression::Address(addr, span))
}
Token::StaticString(value) => Expression::Literal(LiteralExpression::String(value, span)),
Token::Ident(name) => { Token::Ident(name) => {
let ident = Identifier { name, span }; let ident = Identifier { name, span };
if !self.disallow_circuit_construction && self.check(&Token::LeftCurly) { if !self.disallow_circuit_construction && self.check(&Token::LeftCurly) {

View File

@ -22,25 +22,6 @@ use leo_span::sym;
const ASSIGN_TOKENS: &[Token] = &[Token::Assign]; const ASSIGN_TOKENS: &[Token] = &[Token::Assign];
impl ParserContext<'_> { impl ParserContext<'_> {
/// Returns an [`Identifier`] AST node if the given [`Expression`] AST node evaluates to an
/// identifier access. The access is stored in the given accesses.
fn construct_assignee_access(expr: Expression, _accesses: &mut [AssigneeAccess]) -> Result<Identifier> {
match expr {
Expression::Identifier(id) => Ok(id),
_ => Err(ParserError::invalid_assignment_target(expr.span()).into()),
}
}
/// Returns an [`Assignee`] AST node from the given [`Expression`] AST node with accesses.
fn construct_assignee(expr: Expression) -> Result<Assignee> {
let mut accesses = Vec::new();
Ok(Assignee {
span: expr.span(),
identifier: Self::construct_assignee_access(expr, &mut accesses)?,
accesses,
})
}
/// Returns a [`Statement`] AST node if the next tokens represent a statement. /// Returns a [`Statement`] AST node if the next tokens represent a statement.
pub(crate) fn parse_statement(&mut self) -> Result<Statement> { pub(crate) fn parse_statement(&mut self) -> Result<Statement> {
match &self.token.token { match &self.token.token {
@ -56,15 +37,14 @@ impl ParserContext<'_> {
/// Returns a [`Block`] AST node if the next tokens represent a assign, or expression statement. /// Returns a [`Block`] AST node if the next tokens represent a assign, or expression statement.
fn parse_assign_statement(&mut self) -> Result<Statement> { fn parse_assign_statement(&mut self) -> Result<Statement> {
let expr = self.parse_expression()?; let place = self.parse_expression()?;
if self.eat_any(ASSIGN_TOKENS) { if self.eat_any(ASSIGN_TOKENS) {
let value = self.parse_expression()?; let value = self.parse_expression()?;
let assignee = Self::construct_assignee(expr)?;
self.expect(&Token::Semicolon)?; self.expect(&Token::Semicolon)?;
Ok(Statement::Assign(Box::new(AssignStatement { Ok(Statement::Assign(Box::new(AssignStatement {
span: assignee.span + value.span(), span: place.span() + value.span(),
assignee, place,
// Currently only `=` so this is alright. // Currently only `=` so this is alright.
operation: AssignOperation::Assign, operation: AssignOperation::Assign,
value, value,
@ -72,7 +52,7 @@ impl ParserContext<'_> {
} else { } else {
// Error on `expr;` but recover as an empty block `{}`. // Error on `expr;` but recover as an empty block `{}`.
self.expect(&Token::Semicolon)?; self.expect(&Token::Semicolon)?;
let span = expr.span() + self.prev_token.span; let span = place.span() + self.prev_token.span;
self.emit_err(ParserError::expr_stmts_disallowed(span)); self.emit_err(ParserError::expr_stmts_disallowed(span));
Ok(Statement::dummy(span)) Ok(Statement::dummy(span))
} }

View File

@ -17,13 +17,11 @@
use crate::tokenizer::Token; use crate::tokenizer::Token;
use leo_errors::{ParserError, Result}; use leo_errors::{ParserError, Result};
use leo_span::{Span, Symbol}; use leo_span::{Span, Symbol};
use snarkvm_dpc::{prelude::*, testnet2::Testnet2};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::{ use std::{
fmt, fmt,
iter::{from_fn, Peekable}, iter::{from_fn, Peekable},
str::FromStr,
}; };
/// Eat an identifier, that is, a string matching '[a-zA-Z][a-zA-Z\d_]*', if any. /// Eat an identifier, that is, a string matching '[a-zA-Z][a-zA-Z\d_]*', if any.
@ -38,6 +36,14 @@ fn is_bidi_override(c: char) -> bool {
(0x202A..=0x202E).contains(&i) || (0x2066..=0x2069).contains(&i) (0x202A..=0x202E).contains(&i) || (0x2066..=0x2069).contains(&i)
} }
/// Ensure that `string` contains no Unicode Bidirectional Override code points.
fn ensure_no_bidi_override(string: &str) -> Result<()> {
if string.chars().any(is_bidi_override) {
return Err(ParserError::lexer_bidi_override().into());
}
Ok(())
}
impl Token { impl Token {
// todo: remove this unused code or reference https://github.com/Geal/nom/blob/main/examples/string.rs // todo: remove this unused code or reference https://github.com/Geal/nom/blob/main/examples/string.rs
// // Eats the parts of the unicode character after \u. // // Eats the parts of the unicode character after \u.
@ -176,6 +182,7 @@ impl Token {
return Err(ParserError::lexer_empty_input().into()); return Err(ParserError::lexer_empty_input().into());
} }
let input_str = input;
let mut input = input.chars().peekable(); let mut input = input.chars().peekable();
// Consumes a single character token. // Consumes a single character token.
@ -207,28 +214,15 @@ impl Token {
match *input.peek().ok_or_else(ParserError::lexer_empty_input)? { match *input.peek().ok_or_else(ParserError::lexer_empty_input)? {
x if x.is_ascii_whitespace() => return single(&mut input, Token::WhiteSpace), x if x.is_ascii_whitespace() => return single(&mut input, Token::WhiteSpace),
'"' => { '"' => {
let mut string = String::new(); // Find end string quotation mark.
input.next(); // Instead of checking each `char` and pushing, we can avoid reallocations.
let rest = &input_str[1..];
let string = match rest.as_bytes().iter().position(|c| *c == b'"') {
None => return Err(ParserError::lexer_string_not_closed(rest).into()),
Some(idx) => rest[..idx].to_owned(),
};
let mut ended = false; ensure_no_bidi_override(&string)?;
while let Some(c) = input.next() {
// Check for illegal characters.
if is_bidi_override(c) {
return Err(ParserError::lexer_bidi_override().into());
}
// Check for end string quotation mark.
if c == '"' {
input.next();
ended = true;
break;
}
string.push(c);
}
if !ended {
return Err(ParserError::lexer_string_not_closed(string).into());
}
// + 2 to account for parsing quotation marks. // + 2 to account for parsing quotation marks.
return Ok((string.len() + 2, Token::StaticString(string))); return Ok((string.len() + 2, Token::StaticString(string)));
@ -248,21 +242,14 @@ impl Token {
'/' => { '/' => {
input.next(); input.next();
if input.next_if_eq(&'/').is_some() { if input.next_if_eq(&'/').is_some() {
let mut comment = String::from("//"); // Find the end of the comment line.
let comment = match input_str.as_bytes().iter().position(|c| *c == b'\n') {
None => input_str,
Some(idx) => &input_str[..idx + 1],
};
while let Some(c) = input.next_if(|c| c != &'\n') { ensure_no_bidi_override(comment)?;
if is_bidi_override(c) { return Ok((comment.len(), Token::CommentLine(comment.to_owned())));
return Err(ParserError::lexer_bidi_override().into());
}
comment.push(c);
}
if let Some(newline) = input.next_if_eq(&'\n') {
comment.push(newline);
return Ok((comment.len(), Token::CommentLine(comment)));
}
return Ok((comment.len(), Token::CommentLine(comment)));
} else if input.next_if_eq(&'*').is_some() { } else if input.next_if_eq(&'*').is_some() {
let mut comment = String::from("/*"); let mut comment = String::from("/*");
@ -272,9 +259,6 @@ impl Token {
let mut ended = false; let mut ended = false;
while let Some(c) = input.next() { while let Some(c) = input.next() {
if is_bidi_override(c) {
return Err(ParserError::lexer_bidi_override().into());
}
comment.push(c); comment.push(c);
if c == '*' && input.next_if_eq(&'/').is_some() { if c == '*' && input.next_if_eq(&'/').is_some() {
comment.push('/'); comment.push('/');
@ -283,6 +267,8 @@ impl Token {
} }
} }
ensure_no_bidi_override(&comment)?;
if !ended { if !ended {
return Err(ParserError::lexer_block_comment_does_not_close_before_eof(comment).into()); return Err(ParserError::lexer_block_comment_does_not_close_before_eof(comment).into());
} }
@ -381,8 +367,3 @@ impl fmt::Debug for SpannedToken {
<SpannedToken as fmt::Display>::fmt(self, f) <SpannedToken as fmt::Display>::fmt(self, f)
} }
} }
/// Returns true if the given string is a valid Aleo address.
pub(crate) fn check_address(address: &str) -> bool {
Address::<Testnet2>::from_str(address).is_ok()
}

View File

@ -28,11 +28,8 @@ pub(crate) use self::token::*;
pub(crate) mod lexer; pub(crate) mod lexer;
pub(crate) use self::lexer::*; pub(crate) use self::lexer::*;
use leo_errors::{ParserError, Result}; use leo_errors::Result;
use leo_span::{ use leo_span::span::{BytePos, Pos, Span};
span::{BytePos, Pos},
Span,
};
/// Creates a new vector of spanned tokens from a given file path and source code text. /// Creates a new vector of spanned tokens from a given file path and source code text.
pub(crate) fn tokenize(input: &str, start_pos: BytePos) -> Result<Vec<SpannedToken>> { pub(crate) fn tokenize(input: &str, start_pos: BytePos) -> Result<Vec<SpannedToken>> {
@ -42,24 +39,20 @@ pub(crate) fn tokenize(input: &str, start_pos: BytePos) -> Result<Vec<SpannedTok
/// Yields spanned tokens from the given source code text. /// Yields spanned tokens from the given source code text.
/// ///
/// The `lo` byte position determines where spans will start. /// The `lo` byte position determines where spans will start.
pub(crate) fn tokenize_iter(input: &str, mut lo: BytePos) -> impl '_ + Iterator<Item = Result<SpannedToken>> { pub(crate) fn tokenize_iter(mut input: &str, mut lo: BytePos) -> impl '_ + Iterator<Item = Result<SpannedToken>> {
let mut index = 0usize;
iter::from_fn(move || { iter::from_fn(move || {
while input.len() > index { while !input.is_empty() {
let (token_len, token) = match Token::eat(&input[index..]) { let (token_len, token) = match Token::eat(input) {
Err(e) => return Some(Err(e)), Err(e) => return Some(Err(e)),
Ok(t) => t, Ok(t) => t,
}; };
index += token_len; input = &input[token_len..];
let span = Span::new(lo, lo + BytePos::from_usize(token_len)); let span = Span::new(lo, lo + BytePos::from_usize(token_len));
lo = span.hi; lo = span.hi;
match token { match token {
Token::WhiteSpace => continue, Token::WhiteSpace => continue,
Token::AddressLit(address) if !check_address(&address) => {
return Some(Err(ParserError::invalid_address_lit(address, span).into()));
}
_ => return Some(Ok(SpannedToken { token, span })), _ => return Some(Ok(SpannedToken { token, span })),
} }
} }

View File

@ -38,8 +38,8 @@ pub struct SymbolTable<'a> {
} }
impl<'a> SymbolTable<'a> { impl<'a> SymbolTable<'a> {
pub fn check_shadowing(&self, symbol: &Symbol, span: Span) -> Result<()> { pub fn check_shadowing(&self, symbol: Symbol, span: Span) -> Result<()> {
if self.functions.contains_key(symbol) { if self.functions.contains_key(&symbol) {
Err(AstError::shadowed_function(symbol, span).into()) Err(AstError::shadowed_function(symbol, span).into())
} else { } else {
self.variables.check_shadowing(symbol, span)?; self.variables.check_shadowing(symbol, span)?;
@ -52,7 +52,7 @@ impl<'a> SymbolTable<'a> {
} }
pub fn insert_fn(&mut self, symbol: Symbol, insert: &'a Function) -> Result<()> { pub fn insert_fn(&mut self, symbol: Symbol, insert: &'a Function) -> Result<()> {
self.check_shadowing(&symbol, insert.span)?; self.check_shadowing(symbol, insert.span)?;
self.functions.insert(symbol, insert); self.functions.insert(symbol, insert);
Ok(()) Ok(())
} }
@ -67,13 +67,13 @@ impl<'a> SymbolTable<'a> {
} }
pub fn insert_variable(&mut self, symbol: Symbol, insert: VariableSymbol<'a>) -> Result<()> { pub fn insert_variable(&mut self, symbol: Symbol, insert: VariableSymbol<'a>) -> Result<()> {
self.check_shadowing(&symbol, insert.span)?; self.check_shadowing(symbol, insert.span)?;
self.variables.variables.insert(symbol, insert); self.variables.variables.insert(symbol, insert);
Ok(()) Ok(())
} }
pub fn lookup_fn(&self, symbol: &Symbol) -> Option<&&'a Function> { pub fn lookup_fn(&self, symbol: Symbol) -> Option<&&'a Function> {
self.functions.get(symbol) self.functions.get(&symbol)
} }
pub fn lookup_circuit(&self, symbol: &Symbol) -> Option<&&'a Circuit> { pub fn lookup_circuit(&self, symbol: &Symbol) -> Option<&&'a Circuit> {

View File

@ -35,8 +35,8 @@ pub struct VariableScope<'a> {
} }
impl<'a> VariableScope<'a> { impl<'a> VariableScope<'a> {
pub fn check_shadowing(&self, symbol: &Symbol, span: Span) -> Result<()> { pub fn check_shadowing(&self, symbol: Symbol, span: Span) -> Result<()> {
if self.variables.contains_key(symbol) { if self.variables.contains_key(&symbol) {
Err(AstError::shadowed_variable(symbol, span).into()) Err(AstError::shadowed_variable(symbol, span).into())
} else if let Some(parent) = &self.parent { } else if let Some(parent) = &self.parent {
parent.check_shadowing(symbol, span) parent.check_shadowing(symbol, span)

View File

@ -49,56 +49,59 @@ impl<'a> ExpressionVisitorDirector<'a> for Director<'a> {
if let VisitResult::VisitChildren = self.visitor.visit_expression(input) { if let VisitResult::VisitChildren = self.visitor.visit_expression(input) {
return match input { return match input {
Expression::Access(expr) => self.visit_access(expr, expected), Expression::Access(expr) => self.visit_access(expr, expected),
Expression::Identifier(expr) => self.visit_identifier(expr, expected),
Expression::Literal(expr) => self.visit_literal(expr, expected),
Expression::Binary(expr) => self.visit_binary(expr, expected), Expression::Binary(expr) => self.visit_binary(expr, expected),
Expression::Call(expr) => self.visit_call(expr, expected), Expression::Call(expr) => self.visit_call(expr, expected),
Expression::CircuitInit(expr) => self.visit_circuit_init(expr, expected), Expression::CircuitInit(expr) => self.visit_circuit_init(expr, expected),
Expression::Err(expr) => self.visit_err(expr, expected), Expression::Err(expr) => self.visit_err(expr, expected),
Expression::Identifier(expr) => self.visit_identifier(expr, expected),
Expression::Ternary(expr) => self.visit_ternary(expr, expected), Expression::Ternary(expr) => self.visit_ternary(expr, expected),
Expression::Unary(expr) => self.visit_unary(expr, expected), Expression::Unary(expr) => self.visit_unary(expr, expected),
Expression::Value(expr) => self.visit_value(expr, expected),
}; };
} }
None None
} }
fn visit_identifier(&mut self, input: &'a Identifier, expected: &Self::AdditionalInput) -> Option<Self::Output> { fn visit_identifier(&mut self, var: &'a Identifier, expected: &Self::AdditionalInput) -> Option<Self::Output> {
if let VisitResult::VisitChildren = self.visitor.visit_identifier(input) { if let Some(circuit) = self.visitor.symbol_table.clone().lookup_circuit(&var.name) {
return if let Some(circuit) = self.visitor.symbol_table.clone().lookup_circuit(&input.name) { return Some(self.visitor.assert_expected_option(
Some(self.visitor.assert_expected_option(
Type::Identifier(circuit.identifier.clone()), Type::Identifier(circuit.identifier.clone()),
expected, expected,
circuit.span(), circuit.span(),
)) ));
} else if let Some(var) = self.visitor.symbol_table.clone().lookup_variable(&input.name) { } else if let VisitResult::VisitChildren = self.visitor.visit_identifier(var) {
Some(self.visitor.assert_expected_option(*var.type_, expected, var.span)) if let Some(var) = self.visitor.symbol_table.clone().lookup_variable(&var.name) {
return Some(self.visitor.assert_expected_option(*var.type_, expected, var.span));
} else { } else {
self.visitor self.visitor
.handler .handler
.emit_err(TypeCheckerError::unknown_sym("variable", input.name, input.span()).into()); .emit_err(TypeCheckerError::unknown_sym("variable", var.name, var.span()).into());
None
}; };
} }
None None
} }
fn visit_value(&mut self, input: &'a ValueExpression, expected: &Self::AdditionalInput) -> Option<Self::Output> { fn visit_literal(
if let VisitResult::VisitChildren = self.visitor.visit_value(input) { &mut self,
input: &'a LiteralExpression,
expected: &Self::AdditionalInput,
) -> Option<Self::Output> {
if let VisitResult::VisitChildren = self.visitor.visit_literal(input) {
return Some(match input { return Some(match input {
ValueExpression::Address(_, _) => { LiteralExpression::Address(_, _) => {
self.visitor self.visitor
.assert_expected_option(Type::Address, expected, input.span()) .assert_expected_option(Type::Address, expected, input.span())
} }
ValueExpression::Boolean(_, _) => { LiteralExpression::Boolean(_, _) => {
self.visitor self.visitor
.assert_expected_option(Type::Boolean, expected, input.span()) .assert_expected_option(Type::Boolean, expected, input.span())
} }
ValueExpression::Field(_, _) => { LiteralExpression::Field(_, _) => {
self.visitor.assert_expected_option(Type::Field, expected, input.span()) self.visitor.assert_expected_option(Type::Field, expected, input.span())
} }
ValueExpression::Integer(type_, str_content, _) => { LiteralExpression::Integer(type_, str_content, _) => {
match type_ { match type_ {
IntegerType::I8 => { IntegerType::I8 => {
let int = if self.visitor.negate { let int = if self.visitor.negate {
@ -190,12 +193,12 @@ impl<'a> ExpressionVisitorDirector<'a> for Director<'a> {
self.visitor self.visitor
.assert_expected_option(Type::IntegerType(*type_), expected, input.span()) .assert_expected_option(Type::IntegerType(*type_), expected, input.span())
} }
ValueExpression::Group(_) => self.visitor.assert_expected_option(Type::Group, expected, input.span()), LiteralExpression::Group(_) => self.visitor.assert_expected_option(Type::Group, expected, input.span()),
ValueExpression::Scalar(_, _) => { LiteralExpression::Scalar(_, _) => {
self.visitor self.visitor
.assert_expected_option(Type::Scalar, expected, input.span()) .assert_expected_option(Type::Scalar, expected, input.span())
} }
ValueExpression::String(_, _) => { LiteralExpression::String(_, _) => {
self.visitor self.visitor
.assert_expected_option(Type::String, expected, input.span()) .assert_expected_option(Type::String, expected, input.span())
} }
@ -605,7 +608,7 @@ impl<'a> ExpressionVisitorDirector<'a> for Director<'a> {
fn visit_call(&mut self, input: &'a CallExpression, expected: &Self::AdditionalInput) -> Option<Self::Output> { fn visit_call(&mut self, input: &'a CallExpression, expected: &Self::AdditionalInput) -> Option<Self::Output> {
match &*input.function { match &*input.function {
Expression::Identifier(ident) => { Expression::Identifier(ident) => {
if let Some(func) = self.visitor.symbol_table.clone().lookup_fn(&ident.name) { if let Some(func) = self.visitor.symbol_table.clone().lookup_fn(ident.name) {
let ret = self.visitor.assert_expected_option(func.output, expected, func.span()); let ret = self.visitor.assert_expected_option(func.output, expected, func.span());
// Check number of function arguments. // Check number of function arguments.

View File

@ -29,7 +29,7 @@ impl<'a> StatementVisitorDirector<'a> for Director<'a> {
// statements should always have some parent block // statements should always have some parent block
let parent = self.visitor.parent.unwrap(); let parent = self.visitor.parent.unwrap();
let return_type = &self.visitor.symbol_table.lookup_fn(&parent).map(|f| f.output); let return_type = &self.visitor.symbol_table.lookup_fn(parent).map(|f| f.output);
self.visitor.check_ident_type(return_type); self.visitor.check_ident_type(return_type);
self.visitor.has_return = true; self.visitor.has_return = true;
@ -62,8 +62,17 @@ impl<'a> StatementVisitorDirector<'a> for Director<'a> {
} }
fn visit_assign(&mut self, input: &'a AssignStatement) { fn visit_assign(&mut self, input: &'a AssignStatement) {
let var_name = &input.assignee.identifier.name; let var_name = match input.place {
let var_type = if let Some(var) = self.visitor.symbol_table.lookup_variable(var_name) { Expression::Identifier(id) => id,
_ => {
self.visitor
.handler
.emit_err(TypeCheckerError::invalid_assignment_target(input.place.span()).into());
return;
}
};
let var_type = if let Some(var) = self.visitor.symbol_table.lookup_variable(&var_name.name) {
match &var.declaration { match &var.declaration {
Declaration::Const => self Declaration::Const => self
.visitor .visitor
@ -78,9 +87,9 @@ impl<'a> StatementVisitorDirector<'a> for Director<'a> {
Some(*var.type_) Some(*var.type_)
} else { } else {
self.visitor.handler.emit_err( self.visitor
TypeCheckerError::unknown_sym("variable", &input.assignee.identifier.name, input.assignee.span).into(), .handler
); .emit_err(TypeCheckerError::unknown_sym("variable", var_name.name, var_name.span).into());
None None
}; };

View File

@ -120,14 +120,6 @@ create_messages!(
help: None, help: None,
} }
/// For when the parser encountered an invalid assignment target.
@formatted
invalid_assignment_target {
args: (),
msg: "invalid assignment target",
help: None,
}
/// For when the parser encountered an invalid package name. /// For when the parser encountered an invalid package name.
@formatted @formatted
invalid_package_name { invalid_package_name {

View File

@ -23,6 +23,14 @@ create_messages!(
code_mask: 2000i32, code_mask: 2000i32,
code_prefix: "TYC", code_prefix: "TYC",
/// For when the parser encountered an invalid assignment target.
@formatted
invalid_assignment_target {
args: (),
msg: "invalid assignment target",
help: None,
}
/// For when the user tries to assign to a const input. /// For when the user tries to assign to a const input.
@formatted @formatted
cannont_assign_to_const_input { cannont_assign_to_const_input {

View File

@ -1,5 +1,5 @@
/* /*
namespace: ParseStatement namespace: Compile
expectation: Fail expectation: Fail
*/ */
@ -27,4 +27,6 @@ x {x: y, y: z} = y;
x() = y; x() = y;
x.y() = y;
🦀 = y; 🦀 = y;

View File

@ -3,6 +3,6 @@ namespace: Compile
expectation: Pass expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: ed65ff9337fc5a00cd28d780a985bcb05de7d0e5fe02b555774984552f0c14e8 - initial_input_ast: fe880c907d0257c9fc8314b8b98cabd8a8282b587d2d618408cc3cd8e528fda5
initial_ast: c920b653c76c858673ef791ad9f7b42bd8b70e9ddc2c9bd80c48c531f654334f initial_ast: d2bf8199011f00bef93c6cec36528966c69908982ea4a6f2e515c98c258edf25
symbol_table: b736692dc7bdc91c5a808a20a3965f4c8ed2c46c212696d33fc6dd4cfc9a5844 symbol_table: b736692dc7bdc91c5a808a20a3965f4c8ed2c46c212696d33fc6dd4cfc9a5844

View File

@ -3,6 +3,6 @@ namespace: Compile
expectation: Pass expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: c7315faf1ac3ceeb90260e64e4a411a27a8aa732892a64c15f49e81adf464beb - initial_input_ast: 00f5aba05e4efae5a125eb52f02f16400132085b8a34919d910aa40c6c405a22
initial_ast: a2e6b33ed645f7e94b0f4ba40a107543075f53ed5f896072e03d53fbc0ed6462 initial_ast: d9baeb1448040c61f5e7f779270eb767a29b5f2fd23a60a680aad138327999e7
symbol_table: a712053d471b6165809fc2b4f717282ea5590a2cfaeae8a630c8a3250478d179 symbol_table: a712053d471b6165809fc2b4f717282ea5590a2cfaeae8a630c8a3250478d179

View File

@ -3,7 +3,7 @@ namespace: Compile
expectation: Pass expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: dc6b4b00185dd6c1f2b83a1bfae619c1d6e3f68ac0f1d3d87ae3bd0ed5caf083 - initial_input_ast: 03e9df3bd1409f4af9e2a7f55130bc52f27d41f32a624ffa27f0ab114bf6fbf4
- initial_input_ast: 73a38568160c3d2be402043d04ccdc2290abe27647bc81c4bd50367834c206cf - initial_input_ast: 9a0d83e67799f28ec6613d9aac9d921aea81eebb68c9682de33c69036c4a924f
initial_ast: afd8bb3f641e3b6020e6ecc30b4db3848409190b5a12e3ddff3f289051ccdce2 initial_ast: ea3c9a73110ccc7684863543cf563ec78349402c460a75317b776af11d46f781
symbol_table: 18395a136ea969d319cc4c12c59bb7a590a1b11339375240700d7c87f26b1d5d symbol_table: 18395a136ea969d319cc4c12c59bb7a590a1b11339375240700d7c87f26b1d5d

View File

@ -3,7 +3,7 @@ namespace: Compile
expectation: Pass expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: b6371958e735320861c84ed514f258ae8a9858b34615364b2f9ebbaa2aaadd8c - initial_input_ast: ec3cfeb93ea66a530150a5c5e2bd396688b3ef9b9fb0bcb961c62dac4daa064e
- initial_input_ast: d384cfea1a36220e9ea4e246ece89d8fffa320f90aeeb85660bc445ab62a0829 - initial_input_ast: cb1d48114c10b2b732ad47a46fc8d05bf7a3e783da89e7f00065244bfc8d15c8
initial_ast: d8a742c349763f7a2a55520aa196514e1536491cfb84adcfb0965b05a0c8af49 initial_ast: 1bbe35b9a1a767668b4ff0d689873caded5d92ea7886aad2355a404511d76199
symbol_table: 82f5e85488d21fdf066d318b2c31504f4fd77b98747286b4a030c2e2a568e5d6 symbol_table: 82f5e85488d21fdf066d318b2c31504f4fd77b98747286b4a030c2e2a568e5d6

View File

@ -3,9 +3,9 @@ namespace: Compile
expectation: Pass expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: e6457724e4c3bb27eca30df861f711f962ac47fb0e7d0b9dc959be0feaeb7763 - initial_input_ast: da1d028d28792f9625d528ebee6f3abd09b21a7bfa6bb3be5d8c3ad01d974558
- initial_input_ast: c8d27a86795a6d56815a681066b7f462f5476be6d56ec910b74d90c60d8b3cc9 - initial_input_ast: 5f19f0086b0509628dc64db0f69000d599bc761cb8e3125144de44367081126a
- initial_input_ast: 4ff2fb01e2d10a59bf4fcd1ed3b510c6860167dbd3bd4d099c6b8a78d2a767af - initial_input_ast: 4c5eeffd0306b20c8deece509782b81ea8583245f650e40a4a300d517f6ed5f4
- initial_input_ast: 96ddbb84cba723df65571d6537a303189e6274389593980996fd7ee50eab996e - initial_input_ast: a56b3f9908dec2acaed302691d4fe0c2cf046f0deb8f188f617e042e75502f71
initial_ast: 8e4ab3450ec4ffbdba78fc0e1450c319bf538fd716af967419c8ce116ccd3d0e initial_ast: 8e4ab3450ec4ffbdba78fc0e1450c319bf538fd716af967419c8ce116ccd3d0e
symbol_table: 85ba598c10628c776b426b4ff60a5c7ea7d1d58211763c0b088f87965529c12f symbol_table: 85ba598c10628c776b426b4ff60a5c7ea7d1d58211763c0b088f87965529c12f

View File

@ -3,9 +3,9 @@ namespace: Compile
expectation: Pass expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: e7e9fd77647ac56ed68e547bfb8d0c767313030072a510ec138027ffb62fc368 - initial_input_ast: 194c39c41573171b5ba154f70577279b4c535465fe4475c889ea693a81b316c7
- initial_input_ast: e43c024d6fad8a7a04672fa318936703a4798699283f7b66d9383d52acc104a0 - initial_input_ast: 9af3ce639269ea18073cb3b1a19520ba98f0484a04b20526584131d18c54712c
- initial_input_ast: 695d879ad212b23fb3e91fae782c701c5f0469bbcaabdcfc6e5dcadc5b7e6c9a - initial_input_ast: 7a1c39dec2388ab801496ceb17ca85665d2f515269929925b7cc9018e14297ea
- initial_input_ast: 390e951d2b90cf150acd9bc6eeeffbc3a8d7af3ce3781f14ebdce3f1054de4c8 - initial_input_ast: 650984ca5077d11a815889421656b7735b4c6bd320bdf68b4deb87dfc0f49388
initial_ast: 1bc51ad96d1960a2f90f003cbf8588d0bbd2fb18f4c7be6a9452a7c26e0fdead initial_ast: d84cf01e1fddeb09983dc4f7e868ae999b7b9ab4dff9d4286108f81aefe80677
symbol_table: 4fd4e476609947028fbffe357ffb9d962e96c30a9abe3677d75675ae37b12587 symbol_table: 4fd4e476609947028fbffe357ffb9d962e96c30a9abe3677d75675ae37b12587

View File

@ -3,9 +3,9 @@ namespace: Compile
expectation: Pass expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: e6457724e4c3bb27eca30df861f711f962ac47fb0e7d0b9dc959be0feaeb7763 - initial_input_ast: da1d028d28792f9625d528ebee6f3abd09b21a7bfa6bb3be5d8c3ad01d974558
- initial_input_ast: c8d27a86795a6d56815a681066b7f462f5476be6d56ec910b74d90c60d8b3cc9 - initial_input_ast: 5f19f0086b0509628dc64db0f69000d599bc761cb8e3125144de44367081126a
- initial_input_ast: 4ff2fb01e2d10a59bf4fcd1ed3b510c6860167dbd3bd4d099c6b8a78d2a767af - initial_input_ast: 4c5eeffd0306b20c8deece509782b81ea8583245f650e40a4a300d517f6ed5f4
- initial_input_ast: 96ddbb84cba723df65571d6537a303189e6274389593980996fd7ee50eab996e - initial_input_ast: a56b3f9908dec2acaed302691d4fe0c2cf046f0deb8f188f617e042e75502f71
initial_ast: d135ca0877ca63f6c31be572178a69508de9cfb81e258c4aec425861241f84c3 initial_ast: d135ca0877ca63f6c31be572178a69508de9cfb81e258c4aec425861241f84c3
symbol_table: ffcddad7271fd96b863ba3f1446dd9c0021f3fb4ead31942fac8de11d5af1817 symbol_table: ffcddad7271fd96b863ba3f1446dd9c0021f3fb4ead31942fac8de11d5af1817

View File

@ -3,9 +3,9 @@ namespace: Compile
expectation: Pass expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: e6457724e4c3bb27eca30df861f711f962ac47fb0e7d0b9dc959be0feaeb7763 - initial_input_ast: da1d028d28792f9625d528ebee6f3abd09b21a7bfa6bb3be5d8c3ad01d974558
- initial_input_ast: c8d27a86795a6d56815a681066b7f462f5476be6d56ec910b74d90c60d8b3cc9 - initial_input_ast: 5f19f0086b0509628dc64db0f69000d599bc761cb8e3125144de44367081126a
- initial_input_ast: 4ff2fb01e2d10a59bf4fcd1ed3b510c6860167dbd3bd4d099c6b8a78d2a767af - initial_input_ast: 4c5eeffd0306b20c8deece509782b81ea8583245f650e40a4a300d517f6ed5f4
- initial_input_ast: 96ddbb84cba723df65571d6537a303189e6274389593980996fd7ee50eab996e - initial_input_ast: a56b3f9908dec2acaed302691d4fe0c2cf046f0deb8f188f617e042e75502f71
initial_ast: 42cf44d6821d7bd9d2c0222d2a673df9ff9c199f583e79a8b15b8eec53e2aea0 initial_ast: 42cf44d6821d7bd9d2c0222d2a673df9ff9c199f583e79a8b15b8eec53e2aea0
symbol_table: 99728cc6a571e63083031cb630c010cd10c32360086df0494297645d08cf82c2 symbol_table: 99728cc6a571e63083031cb630c010cd10c32360086df0494297645d08cf82c2

View File

@ -3,9 +3,9 @@ namespace: Compile
expectation: Pass expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: b60204e9191bfb24680632af160fc62316e8b8043c0e3908c157855cc5547eb3 - initial_input_ast: e0fdf4f304b80e670735af85014968ae21f78d309ab9ad55bdc5e02167dcbb54
- initial_input_ast: 023263dbb2c455cbc5507aa39f8de80d8d1dbdce22e979302f29046261206ee4 - initial_input_ast: 3254bbbc78ad3eec1c6667ade0b3d3da5ee17c7e569118cc1c771ba607e79ab0
- initial_input_ast: a4ec20e71f9401cb0f085770a98cbafb7ca39b4606215cd044ab413790653294 - initial_input_ast: 19f1be52a19445695f23724e1979b362dd3fcf31aace997c829e2206dc1cccbe
- initial_input_ast: a90726f08c89ae8eeb4becffd30d13acaa925902d2a29b59842dfc9ee8dc2e3a - initial_input_ast: d2fc1992beaf062678bbf6c3e862820dbbea39926589afcdc46c19c8669f0e37
initial_ast: b8707d1d3f6c111db2515d4093d15b4739765bfb9e114ed345ebedce0c04024d initial_ast: b8707d1d3f6c111db2515d4093d15b4739765bfb9e114ed345ebedce0c04024d
symbol_table: e6f7abfd330837d1c643b6b7465c02333b1c895e3e6f624085e8e956ab6e5fe5 symbol_table: e6f7abfd330837d1c643b6b7465c02333b1c895e3e6f624085e8e956ab6e5fe5

View File

@ -3,9 +3,9 @@ namespace: Compile
expectation: Pass expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: e6457724e4c3bb27eca30df861f711f962ac47fb0e7d0b9dc959be0feaeb7763 - initial_input_ast: da1d028d28792f9625d528ebee6f3abd09b21a7bfa6bb3be5d8c3ad01d974558
- initial_input_ast: c8d27a86795a6d56815a681066b7f462f5476be6d56ec910b74d90c60d8b3cc9 - initial_input_ast: 5f19f0086b0509628dc64db0f69000d599bc761cb8e3125144de44367081126a
- initial_input_ast: 4ff2fb01e2d10a59bf4fcd1ed3b510c6860167dbd3bd4d099c6b8a78d2a767af - initial_input_ast: 4c5eeffd0306b20c8deece509782b81ea8583245f650e40a4a300d517f6ed5f4
- initial_input_ast: 96ddbb84cba723df65571d6537a303189e6274389593980996fd7ee50eab996e - initial_input_ast: a56b3f9908dec2acaed302691d4fe0c2cf046f0deb8f188f617e042e75502f71
initial_ast: 6738dda9dfa2cce86f92f9d28e0e0750870156f6b5d6146d063baa221f88df3f initial_ast: 6738dda9dfa2cce86f92f9d28e0e0750870156f6b5d6146d063baa221f88df3f
symbol_table: 6dad9c49c0429f77053df4b683bcc9c8f863000e03f2c1b5936c6c98c24c6476 symbol_table: 6dad9c49c0429f77053df4b683bcc9c8f863000e03f2c1b5936c6c98c24c6476

View File

@ -2,4 +2,4 @@
namespace: Compile namespace: Compile
expectation: Fail expectation: Fail
outputs: outputs:
- "Error [EPAR0370026]: Could not lex the following content: `''`.\n" - "Error [EPAR0370025]: Could not lex the following content: `''`.\n"

View File

@ -2,4 +2,4 @@
namespace: Compile namespace: Compile
expectation: Fail expectation: Fail
outputs: outputs:
- "Error [EPAR0370026]: Could not lex the following content: `'a'`.\n" - "Error [EPAR0370025]: Could not lex the following content: `'a'`.\n"

View File

@ -2,4 +2,4 @@
namespace: Compile namespace: Compile
expectation: Fail expectation: Fail
outputs: outputs:
- "Error [EPAR0370026]: Could not lex the following content: `'z'`.\n" - "Error [EPAR0370025]: Could not lex the following content: `'z'`.\n"

View File

@ -3,6 +3,6 @@ namespace: Compile
expectation: Pass expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: a7361387d9919bb2857c23ee47cc37c63f0c7cbbb7e7c92b700e2c33403fb4eb - initial_input_ast: f1af7e79dff9ede0d2a1c88d5d22801cb3dfe3a9fb34e93bca646e29a61e9f65
initial_ast: 911cec412ed52ce0bc44a7ebb5e1d0e6f7a954c6718e75f06e6715e298b3c8bb initial_ast: 80124fe1a7297907bc27330cfe87117bee204a9f2b8acce053b0778568415a31
symbol_table: 4a29c4b5af2ad1879798454b95b7dd04ae7ecd48289c5f3e7a1e19eaf3921c3b symbol_table: 4a29c4b5af2ad1879798454b95b7dd04ae7ecd48289c5f3e7a1e19eaf3921c3b

View File

@ -3,6 +3,6 @@ namespace: Compile
expectation: Pass expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: 9698e866b0330be095c65ca93f17ed5fe3d31c61d5622eaf54c774d79d3b6950 - initial_input_ast: 15a1f00a6c0ca8141202e45e534b7afd196e9391c184a4efd94f0d0ccf04a59d
initial_ast: 392ae835e23813bebc9247f2dea3c54d171840b66cbb3fb6f323be1cc39cf5dc initial_ast: 0ef8a9cfc447ad3fd1cb0275e91b1d005b7f230a02bf87e0f8ad56be86daa23e
symbol_table: 91cf14380bad96c722953f9731f62aa8717e83951902dd6106bad45d34883e9e symbol_table: 91cf14380bad96c722953f9731f62aa8717e83951902dd6106bad45d34883e9e

View File

@ -3,7 +3,7 @@ namespace: Compile
expectation: Pass expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: e9253dc5764d8870dc6842860993ce0b2495925b3bdb18891b7c4aa67fe0a81d - initial_input_ast: 8b94c0dbc84f44bd29c614b87947e625ad136549ea29ff18233ba5b01ce63c9b
- initial_input_ast: 3153e33ab1630d74ad221b5ce6d5e50c17fb86d91a2aae4ce67b46fec12c1ef4 - initial_input_ast: a62874e75304ab81d487909be1c6b1efa2e5756a2980b46e3bb1368586c3ee83
initial_ast: 7c4a3ed293ab61f90336b928a4acb55f1110a6b8b8e756e2c3f91b227d29b670 initial_ast: 487dcbee6a433329c15b3cd0b23ecc259d4df455906438f3e6cf348ebd63ee02
symbol_table: eb7d67bd533250d35ac68d5247bb6dc11b1aa3c78144e6642fad61e0cf36780b symbol_table: eb7d67bd533250d35ac68d5247bb6dc11b1aa3c78144e6642fad61e0cf36780b

View File

@ -3,6 +3,6 @@ namespace: Compile
expectation: Pass expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: 6b9e5227fdce9f916cd2398ea85c2d7e7b2f7d706bfa730b8cd1acdeb3f168cd - initial_input_ast: 14cd2c781b154a9037de84e945cfb348e9c587cef94d3e1f3be83e4306f92a0e
initial_ast: bc7585d64765e570d5b1679250f105b2d57b2d94166ed88b06a22bfeaef0fdbf initial_ast: d718de3086bc78a00a392e3c2b46dfa8f76084909bad3c98a5a6759df73efb27
symbol_table: defa532673c067b1029a2cb28e1ceb49c7f6f99afbc670d886d2db938168d424 symbol_table: defa532673c067b1029a2cb28e1ceb49c7f6f99afbc670d886d2db938168d424

View File

@ -3,6 +3,6 @@ namespace: Compile
expectation: Pass expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: 89959164cbf734ac0d261c7459b9c1214eb2f4b3ab9ec57a0b22db487d6537e4 - initial_input_ast: fd19d82c3aba921f01b37174e3eb7fb603438506fe511657e21235b9fb3647d2
initial_ast: 25f4b353ead7c3435761c93e92900ef85f978e1a4ed2298f239ea396594361d6 initial_ast: 2a99ef2515c58607e4b617f93c74838b6f2afed28e9e2c2eed658cea6d729b2d
symbol_table: 1114eb323c8af79b301823753b911c49af1498481ad93b054c6330f00539dcdc symbol_table: 1114eb323c8af79b301823753b911c49af1498481ad93b054c6330f00539dcdc

View File

@ -3,7 +3,7 @@ namespace: Compile
expectation: Pass expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: 4132cf36ac66f6b23e249f81b5c2aafa58e4e5e945920cc29752edc5d6d8057f - initial_input_ast: 06fad995841b833ef5074920ae270b93bf82ad60b6c8b440c66b8bc5018aaa72
- initial_input_ast: 586ed72429932a1aafcd0f8eed983a4babff8eada9c028b88bbeef24dab1cbc0 - initial_input_ast: 34bd981451bdeb915a2de749b969c8804c06e44a9f4473f36d6efac7617baead
initial_ast: f8315b82b0a05e0e69fb8b0342b46cbee976ec20d62e0edd2f066bf51acd81d6 initial_ast: f8315b82b0a05e0e69fb8b0342b46cbee976ec20d62e0edd2f066bf51acd81d6
symbol_table: 6df0605a8770c3002b2f6dfff805332c774cd382d68860fa029a51c01dfca6e1 symbol_table: 6df0605a8770c3002b2f6dfff805332c774cd382d68860fa029a51c01dfca6e1

View File

@ -3,6 +3,6 @@ namespace: Compile
expectation: Pass expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: 5411bd17943bb0aa7b0bb27e8b38f57fd27f06f2080b13a32eee50c53de66f6c - initial_input_ast: 0961f603812e241567b6e3ef5adb458309f1829eb2c08a216efccb17bea89faf
initial_ast: 32e39793865272af182a2cd74c9c337587bcc7e736748b1ab2de58b3c7e1973e initial_ast: 3602c929b2256f4ed5cec2ba9d3e967b029a7dc9717a371b32a356425cf9892b
symbol_table: 21187c3fcd8b5c1377772413f1aedc33d9b4fa34a6d43425b5b9a403ac44cf1b symbol_table: 21187c3fcd8b5c1377772413f1aedc33d9b4fa34a6d43425b5b9a403ac44cf1b

View File

@ -3,6 +3,6 @@ namespace: Compile
expectation: Pass expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: 18e8a4118829470d3150268bbf8d298954e1f566ea2d42ed9f3660dc25c23fcc - initial_input_ast: f18a0e019ca4719c4c4ef5b7313f562c3bc9581819d161d84566e706f3765249
initial_ast: 5fc267c1e4a6c7f631816a0b4002a775cb16fb99bd1d3f5f77057050570ce061 initial_ast: f319125731635279a198fb2df8c0446475024c70829e9de32fa5f43c38079862
symbol_table: 4f4561e0804f02ca6cd58fd37cca46531d6a86fb4f6a3dea46c67c3a13e045dd symbol_table: 4f4561e0804f02ca6cd58fd37cca46531d6a86fb4f6a3dea46c67c3a13e045dd

View File

@ -3,6 +3,6 @@ namespace: Compile
expectation: Pass expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: caa45de3b412d749048b9be732a4593f3094c671701093103f580817a741acbb - initial_input_ast: 16910a94cf1f803ae6425ae6bee9422b01651c2c243b5e46807dc3191d169e64
initial_ast: a2db21567eb5e4d8c867af3946fc83c97a8d5573afcdf291f0141afb1ba8292c initial_ast: 52824ac2e84097578faf0ff92f7ca840d2de30e8454a540886123a2cf79192ae
symbol_table: 57cd0f756819d90c70fc09987ac1bbf2ddf31c7a72cbfd98b8b56a6fc7705581 symbol_table: 57cd0f756819d90c70fc09987ac1bbf2ddf31c7a72cbfd98b8b56a6fc7705581

View File

@ -2,4 +2,4 @@
namespace: Compile namespace: Compile
expectation: Fail expectation: Fail
outputs: outputs:
- "Error [ETYC0372013]: The type ComputeKey is a reserved core type name.\n --> compiler-test:4:35\n |\n 4 | function main(public compute_key: ComputeKey, a: bool) -> bool {\n | ^^^^^^^^^^\n" - "Error [ETYC0372014]: The type ComputeKey is a reserved core type name.\n --> compiler-test:4:35\n |\n 4 | function main(public compute_key: ComputeKey, a: bool) -> bool {\n | ^^^^^^^^^^\n"

View File

@ -2,4 +2,4 @@
namespace: Compile namespace: Compile
expectation: Fail expectation: Fail
outputs: outputs:
- "Error [ETYC0372013]: The type PrivateKey is a reserved core type name.\n --> compiler-test:4:35\n |\n 4 | function main(public private_key: PrivateKey, a: bool) -> bool {\n | ^^^^^^^^^^\n" - "Error [ETYC0372014]: The type PrivateKey is a reserved core type name.\n --> compiler-test:4:35\n |\n 4 | function main(public private_key: PrivateKey, a: bool) -> bool {\n | ^^^^^^^^^^\n"

View File

@ -2,4 +2,4 @@
namespace: Compile namespace: Compile
expectation: Fail expectation: Fail
outputs: outputs:
- "Error [ETYC0372013]: The type Record is a reserved core type name.\n --> compiler-test:4:30\n |\n 4 | function main(public record: Record, a: bool) -> bool {\n | ^^^^^^\n" - "Error [ETYC0372014]: The type Record is a reserved core type name.\n --> compiler-test:4:30\n |\n 4 | function main(public record: Record, a: bool) -> bool {\n | ^^^^^^\n"

View File

@ -2,4 +2,4 @@
namespace: Compile namespace: Compile
expectation: Fail expectation: Fail
outputs: outputs:
- "Error [ETYC0372013]: The type Signature is a reserved core type name.\n --> compiler-test:4:33\n |\n 4 | function main(public signature: Signature, a: bool) -> bool {\n | ^^^^^^^^^\n" - "Error [ETYC0372014]: The type Signature is a reserved core type name.\n --> compiler-test:4:33\n |\n 4 | function main(public signature: Signature, a: bool) -> bool {\n | ^^^^^^^^^\n"

View File

@ -2,4 +2,4 @@
namespace: Compile namespace: Compile
expectation: Fail expectation: Fail
outputs: outputs:
- "Error [ETYC0372013]: The type ViewKey is a reserved core type name.\n --> compiler-test:4:32\n |\n 4 | function main(public view_key: ViewKey, a: bool) -> bool {\n | ^^^^^^^\n" - "Error [ETYC0372014]: The type ViewKey is a reserved core type name.\n --> compiler-test:4:32\n |\n 4 | function main(public view_key: ViewKey, a: bool) -> bool {\n | ^^^^^^^\n"

View File

@ -4,5 +4,5 @@ expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: no input - initial_input_ast: no input
initial_ast: 4977eefec7cfb3fd6ddf418c303b8d119a9bbe26265ff6e5e81ad07d6df04ab3 initial_ast: fc0f2558100be5c1216c0d56e8be51be6ad4f51e47e42f89b96d1b9bae0ae34d
symbol_table: 00e1ab10d05676c51e65671158712d7041de760ca226f74a2314f1cef9740402 symbol_table: 00e1ab10d05676c51e65671158712d7041de760ca226f74a2314f1cef9740402

View File

@ -4,5 +4,5 @@ expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: no input - initial_input_ast: no input
initial_ast: f8964b92b0e8d29b284d471e467b9fdc7af981643bc56ff11bf8f5687b410fee initial_ast: 8c3b9cf2aad8ba67eb351b67ed4642caa64a7ff83a2dcdc48f05413bba7ba81f
symbol_table: 4a439652db94447b85f87bdd262953b6b6233e2d5f22c562215fd792f59f04d3 symbol_table: 4a439652db94447b85f87bdd262953b6b6233e2d5f22c562215fd792f59f04d3

View File

@ -2,4 +2,4 @@
namespace: Compile namespace: Compile
expectation: Fail expectation: Fail
outputs: outputs:
- "Error [ETYC0372008]: Expected one type from `bool,i8,i16,i32,i64,u8,u16,u32,u64,string,`, but got `u128`\n --> compiler-test:4:20\n |\n 4 | let a: group = Pedersen64::hash(1u128);\n | ^^^^^^^^^^^^^^^^^^^^^^^\n" - "Error [ETYC0372009]: Expected one type from `bool,i8,i16,i32,i64,u8,u16,u32,u64,string,`, but got `u128`\n --> compiler-test:4:20\n |\n 4 | let a: group = Pedersen64::hash(1u128);\n | ^^^^^^^^^^^^^^^^^^^^^^^\n"

View File

@ -4,5 +4,5 @@ expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: no input - initial_input_ast: no input
initial_ast: 6148244dc50cddd04bc2f1ac1e339355e7ab8927f198d21cfdab98a085a3aa3b initial_ast: 0a7abaad3d4eb543b09e8664f8b274714f742bec62c45fe56dd6bece0a19161e
symbol_table: 43835e3ddb0a6a15f6ace2186576a1a51de6ad7251d29ff13302546bf1b46a42 symbol_table: 43835e3ddb0a6a15f6ace2186576a1a51de6ad7251d29ff13302546bf1b46a42

View File

@ -3,6 +3,6 @@ namespace: Compile
expectation: Pass expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: 4a7171bfd4cb5b69729e26e4c6b0915f261d3f51b2937d8de5009069f56abfc1 - initial_input_ast: b649852fa2fd7eda05bd0ba261f01dcee93b6b825d5d30fddb8dd5c5710081ca
initial_ast: 1b835098e62d2dd40c820b49114bb71f86c84e8b5a842ead7aa651103ceb651e initial_ast: 13b0f0680422f4f647cb4da2fef412662f35b745ba788ce147add5eeccb2edaa
symbol_table: 18c4e80dbb6add0a75bd0f6968cd3216e3023f383a17679f892b32e24cf2cd77 symbol_table: 18c4e80dbb6add0a75bd0f6968cd3216e3023f383a17679f892b32e24cf2cd77

View File

@ -2,4 +2,4 @@
namespace: Compile namespace: Compile
expectation: Fail expectation: Fail
outputs: outputs:
- "Error [ETYC0372004]: Unknown variable `b`\n --> compiler-test:4:14\n |\n 4 | \tlet b: u8 = b;\n | ^\n" - "Error [ETYC0372005]: Unknown variable `b`\n --> compiler-test:4:14\n |\n 4 | \tlet b: u8 = b;\n | ^\n"

View File

@ -3,6 +3,6 @@ namespace: Compile
expectation: Pass expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: 770cad45d17364fd3acd19fb67c66ea8f58ea54c5c42386d1a0fe02f241e9f2b - initial_input_ast: 3f35e74d282a1e5281e7f283d1e572a3dc75dea1a5ef1a0f8c7f46412ef946a7
initial_ast: 0aebc18388f6ceed8c1d813152ec6392bf687a814d3ae6d63ae10b50420c1a43 initial_ast: 0aebc18388f6ceed8c1d813152ec6392bf687a814d3ae6d63ae10b50420c1a43
symbol_table: ab937c57964d900b6931dc3cea2c6cc6bd68fefe9accae8ef8fd879e788d0cb7 symbol_table: ab937c57964d900b6931dc3cea2c6cc6bd68fefe9accae8ef8fd879e788d0cb7

View File

@ -3,6 +3,6 @@ namespace: Compile
expectation: Pass expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: 3b1682d80f44da8eb1ea0d1236b5b9be15f7d4792fe7f31139a4362b2952d6a0 - initial_input_ast: 4e3882d83c8044e40258f8414966b09c715b00e08bc3383030cecf2c4a825c60
initial_ast: 924a3905b44bfea2a10118e4c0336a596b6981a7b06ea39f71daac7000e5cf9c initial_ast: 924a3905b44bfea2a10118e4c0336a596b6981a7b06ea39f71daac7000e5cf9c
symbol_table: e0b1cda1db6ea8c9f71a6cd9f76a041387e633b0eb652a3382e56ac48aec5adc symbol_table: e0b1cda1db6ea8c9f71a6cd9f76a041387e633b0eb652a3382e56ac48aec5adc

View File

@ -3,6 +3,6 @@ namespace: Compile
expectation: Pass expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: 1d6d705c0d5363431af8b58173f1061d4315c4ffe9ae175d6dd1c7ea2a01488f - initial_input_ast: eeba130bda3ee24f2a4bf92f67fb555ab849173910a647096e28729c2ebd71c2
initial_ast: 3546a10b24a6a53ee07d298e7dbbed5122bd9d0c973613296a94189d9e57f246 initial_ast: 3546a10b24a6a53ee07d298e7dbbed5122bd9d0c973613296a94189d9e57f246
symbol_table: 2685013e472435f156a9de89e73adfedb6e0b214a0fc09b235c453885e644746 symbol_table: 2685013e472435f156a9de89e73adfedb6e0b214a0fc09b235c453885e644746

View File

@ -3,6 +3,6 @@ namespace: Compile
expectation: Pass expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: ccecfe74d5a1f89e892c982f5bf5bb59e094ade3b745b615ab1dcdc31b43dcd7 - initial_input_ast: 3a510480221eb323713b4b10cc374ba357f130e8ac2b07bf1c69ad5d8c936f12
initial_ast: 6a00c3fe77606f34d449fa1c4f8975612edab5c066de791629cbf8c8cb61f289 initial_ast: ff341146cdbb78e4a5bffd47c109cc9987dd3b7cea8224e0ef3668394d1c7a90
symbol_table: 61dabf815d0a52853b5933812e28a24dc2cc71a0196ab334e9f36621f6528669 symbol_table: 61dabf815d0a52853b5933812e28a24dc2cc71a0196ab334e9f36621f6528669

View File

@ -3,6 +3,6 @@ namespace: Compile
expectation: Pass expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: 770cad45d17364fd3acd19fb67c66ea8f58ea54c5c42386d1a0fe02f241e9f2b - initial_input_ast: 3f35e74d282a1e5281e7f283d1e572a3dc75dea1a5ef1a0f8c7f46412ef946a7
initial_ast: c05e588dae9e5f6e7e1c2d16d08629af8d287b453796b21de89b25d40970ec1b initial_ast: c05e588dae9e5f6e7e1c2d16d08629af8d287b453796b21de89b25d40970ec1b
symbol_table: 51cac1a817eead5ffdce703f843e85cdd2ab3ac6ddcb1868fc299ce470aacfb8 symbol_table: 51cac1a817eead5ffdce703f843e85cdd2ab3ac6ddcb1868fc299ce470aacfb8

View File

@ -3,6 +3,6 @@ namespace: Compile
expectation: Pass expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: a2440344211fa1dec9858bba8ae80c44b17dcf10d6d75bf639bd9019de97a843 - initial_input_ast: 9206742d7f18345efbd4d9077cd1aca0855d43a2436be0697ec22954650e3737
initial_ast: c2122be4da96294b4ce4bca5d239176c6bb98765248c767dd41352b6b95888c8 initial_ast: c2122be4da96294b4ce4bca5d239176c6bb98765248c767dd41352b6b95888c8
symbol_table: 2daa5df91bfa772cfaec061d0b52b9663df25e1c2018fefd9a72b878e9f347a0 symbol_table: 2daa5df91bfa772cfaec061d0b52b9663df25e1c2018fefd9a72b878e9f347a0

View File

@ -3,6 +3,6 @@ namespace: Compile
expectation: Pass expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: 43779f378cd19259ccb2a1efc7834a6278bb513e74ee405ba435f7f0690cf902 - initial_input_ast: 047866515f4dc74cd9966242734984b53e72f87afc21f7171b118e6defa1f166
initial_ast: 49b4956c647eb7f6e1ae496ce2e5c4ff238493d9cbc9d20d6f0f3fee09dee4f4 initial_ast: 49b4956c647eb7f6e1ae496ce2e5c4ff238493d9cbc9d20d6f0f3fee09dee4f4
symbol_table: 0adb5745c4fc836bedd364a83bea10dab7885dc32a4145fd04a57b51bd2b23d1 symbol_table: 0adb5745c4fc836bedd364a83bea10dab7885dc32a4145fd04a57b51bd2b23d1

View File

@ -3,6 +3,6 @@ namespace: Compile
expectation: Pass expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: ff3a3f5067b97fc7ac387dbfbb940a8c04f5755783dbf848f661d1962a594bb3 - initial_input_ast: 5e0a61d909d2e94dfbc95775e4c5c356adb61375ceef2d583a5ab927b3b6342e
initial_ast: 23a0dad3f44569081d0c2c788294753013f617772622e5b4e96cd62850a03a3b initial_ast: ecf60185d2eda458885b00f1daa586132dfbfc560b0565c1659bb4bfed3cb19d
symbol_table: 137dd2867c357412b9e5d9dfb51e9e82998217d06f1e07d95999c5c7f312affc symbol_table: 137dd2867c357412b9e5d9dfb51e9e82998217d06f1e07d95999c5c7f312affc

View File

@ -3,6 +3,6 @@ namespace: Compile
expectation: Pass expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: 3b1682d80f44da8eb1ea0d1236b5b9be15f7d4792fe7f31139a4362b2952d6a0 - initial_input_ast: 4e3882d83c8044e40258f8414966b09c715b00e08bc3383030cecf2c4a825c60
initial_ast: 44033abf4e0e2d174cc770b32f903b8a1d4505ee4cbfdcfca3ad1f885071123e initial_ast: 44033abf4e0e2d174cc770b32f903b8a1d4505ee4cbfdcfca3ad1f885071123e
symbol_table: a462d7481d4ae6611c332491239401d32ed2dd110042de237495731107048b4e symbol_table: a462d7481d4ae6611c332491239401d32ed2dd110042de237495731107048b4e

View File

@ -3,6 +3,6 @@ namespace: Compile
expectation: Pass expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: c3b606138d1dc5f4dc541ddc113fb7d6e07cad4cbd1f382fcc0f9b8517077448 - initial_input_ast: e19dcac0064fed4ec8293b9b40ec70cb94b5fdb05f1081fc29f46a023bf79b09
initial_ast: b3c731d5b84eec276e7f142f589405dfa2d8e38157d789c204acaed291edc6ff initial_ast: 8efd26ef8db8c5c793450a368ec66d7a3fe3b363145655192344af4a8c2b4d81
symbol_table: 8efd055a1ca3e84e7af524acdb2d517b1d31c773fb5d0d9045eaaab2112fe184 symbol_table: 8efd055a1ca3e84e7af524acdb2d517b1d31c773fb5d0d9045eaaab2112fe184

View File

@ -3,6 +3,6 @@ namespace: Compile
expectation: Pass expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: 138147dfed32a1089f1d6a4ce19ef4f5278dcdbc2012c432ab460bc0601aaa11 - initial_input_ast: f4c81e7647e3b7cb29e8faf5456878989cbc81cb49097acf5bc9aaafc9092b6b
initial_ast: 1c957ff165af19ab244d1bc9855c9cd245a45602248516d916e323dbfc861f47 initial_ast: ed69198e934ac7f6a604adb37a4b27ad593909930029904db802c1895d7269c9
symbol_table: df0627c52620cf6e30c96450283a76175c4d1a49dc7ffed195a02e3cdde5ed89 symbol_table: df0627c52620cf6e30c96450283a76175c4d1a49dc7ffed195a02e3cdde5ed89

View File

@ -3,6 +3,6 @@ namespace: Compile
expectation: Pass expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: 78b65cde248c05f4abfe2d3cf794fbd44de082303631db7e3002aa724099fee1 - initial_input_ast: 1febcc333f69e7f5ea2e8b9e915c66a23f4e195c6106a31cffb1adb81b90f0e4
initial_ast: 32baf53a93f4c65aa96be164fb1d7ea3b611340e6d5e7b1ee4f0c852efe5c8a1 initial_ast: 7df50863de140cd6033391d929212b91180ff90737c536e631f977ddf9eb9d91
symbol_table: 738974bc93d03e230299143f22c4a8cb38e0962af93e19728f74a6bb8d25a6d0 symbol_table: 738974bc93d03e230299143f22c4a8cb38e0962af93e19728f74a6bb8d25a6d0

View File

@ -3,6 +3,6 @@ namespace: Compile
expectation: Pass expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: 14d0aff05a3b8673ac44d18a969bd03157e19a724ebe2b6e805fdc82aa1e070d - initial_input_ast: ae87aca959c3d818c9259be6ca73eca6ada9633312e81a4df172d833f40c78e9
initial_ast: ddc98689a76296f035d6ae14e467c3a68050bb6bfacbcf55a349fe4441011083 initial_ast: 24bdae47f1154abc4c7f8dbe30dde72ae25779e4464e8942968c7fd36f602d42
symbol_table: 69b32d3a21ca899d23b9eba6603ce9eea7191eb9a7a893e28ef3fcc6b355a4ff symbol_table: 69b32d3a21ca899d23b9eba6603ce9eea7191eb9a7a893e28ef3fcc6b355a4ff

View File

@ -2,4 +2,4 @@
namespace: Compile namespace: Compile
expectation: Fail expectation: Fail
outputs: outputs:
- "Error [ETYC0372014]: The function main has no return statement.\n --> compiler-test:3:1\n |\n 3 | function main() -> u8 {}\n | ^^^^^^^^^^^^^^^^^^^^^^^^\n" - "Error [ETYC0372015]: The function main has no return statement.\n --> compiler-test:3:1\n |\n 3 | function main() -> u8 {}\n | ^^^^^^^^^^^^^^^^^^^^^^^^\n"

View File

@ -3,6 +3,6 @@ namespace: Compile
expectation: Pass expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: 5b2906e1b93966fe1b141bb06b4aa45f7a6e60ae0c0895b96cf870eb246e98b4 - initial_input_ast: 6b8596d250b3c42a0ff9856eb4a94d28c72b2953313d594f13a5d3f1de6f072f
initial_ast: 0c1ab684ff51a2b52916570b816761060c361d202f81698ae8608bb785a453b4 initial_ast: a21fe86230689152fbfcf3529c818c0ef25fe9f3117de260f85ae84cc535c503
symbol_table: 6b9e0d6f8517252051117e01937bb64597c6ee78726e8e03579161084f37303f symbol_table: 6b9e0d6f8517252051117e01937bb64597c6ee78726e8e03579161084f37303f

View File

@ -3,6 +3,6 @@ namespace: Compile
expectation: Pass expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: 1ee96076151487dc5e1988331d53506585dd380909cbeab8c32d3f6e6913456d - initial_input_ast: d11a4218606717322234d8ea4c4786d6edce90f07abde9e120d597cb0e838ce0
initial_ast: ae8cfc6c935d6b293214d82a84be9f135a3894c4eedc0b8c9d96316e00ef0015 initial_ast: 9a7092fce407db3067a8ed1a90dbd5613dff7d581d2df73ce7f6701ff64e5e0b
symbol_table: 9a6f8767701001d0691ff622fada6be3d30c274590d54f847ddb76d7b3da543a symbol_table: 9a6f8767701001d0691ff622fada6be3d30c274590d54f847ddb76d7b3da543a

View File

@ -2,4 +2,4 @@
namespace: Compile namespace: Compile
expectation: Fail expectation: Fail
outputs: outputs:
- "Error [EPAR0370041]: Expression statements are not supported.\n --> compiler-test:4:5\n |\n 4 | my_function();\n | ^^^^^^^^^^^^^^" - "Error [EPAR0370040]: Expression statements are not supported.\n --> compiler-test:4:5\n |\n 4 | my_function();\n | ^^^^^^^^^^^^^^"

View File

@ -3,6 +3,6 @@ namespace: Compile
expectation: Pass expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: f4e1b23f37abb9bcb386ddfd37ee066395d8e84f8ace0f4eb467264131e89fb0 - initial_input_ast: a28b88dc36ace78ed0de93b56db7274f16521597ccf1e820a17fdb60a1e3d92a
initial_ast: 7109d173cdd239abf5f0f717e669e300cf7bd4b3bde2158a17d1f16c1b154276 initial_ast: 7109d173cdd239abf5f0f717e669e300cf7bd4b3bde2158a17d1f16c1b154276
symbol_table: 915e736b00c979abe896125d986ff41cf16e028842f89cae6440998f85304351 symbol_table: 915e736b00c979abe896125d986ff41cf16e028842f89cae6440998f85304351

View File

@ -3,6 +3,6 @@ namespace: Compile
expectation: Pass expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: a183384b085186e92efdf0ccd221ba0f3de6e75cffc5610ed583ccd95aa4adcb - initial_input_ast: 00c3cc87ce3c30894ad6b6874ce6dacfa02c9f2bc171615ff627f06f2e201997
initial_ast: b6e75e27703bf6b6af69de95f9c22ef2033db46227f5658a9f2e88c33a169b1d initial_ast: b6e75e27703bf6b6af69de95f9c22ef2033db46227f5658a9f2e88c33a169b1d
symbol_table: fb66c9abb24c6c1bb79dd5fe9e9b78f293292fb3fab04ede561f866c6dc41f8c symbol_table: fb66c9abb24c6c1bb79dd5fe9e9b78f293292fb3fab04ede561f866c6dc41f8c

View File

@ -4,5 +4,5 @@ expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: no input - initial_input_ast: no input
initial_ast: 947cab0ff6523744676bcf2b5d610c963f5dc1ba18f52e12eb9313914e81ccef initial_ast: 7631f3258e3f0f288fd21a0470c43f636b96bbe0f3643dad29353e9b48c63ee6
symbol_table: 9a61702119ebc681917d7cb7e40ecafa00354849326bf1182635f27a28da35e9 symbol_table: 9a61702119ebc681917d7cb7e40ecafa00354849326bf1182635f27a28da35e9

View File

@ -4,5 +4,5 @@ expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: no input - initial_input_ast: no input
initial_ast: da7a9bfecd63ce811480fa7eed9bdc4bc6223c957e7e12fdbcd69a84d48da1ad initial_ast: 97c27f26fd8d201623b1cbb19474a2cb6934c6bda8d4b363c831b0a3193e75ec
symbol_table: e4a96223c049893c904a90f24d069592b33fc137de0f4816cf92089e63663693 symbol_table: e4a96223c049893c904a90f24d069592b33fc137de0f4816cf92089e63663693

View File

@ -4,5 +4,5 @@ expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: no input - initial_input_ast: no input
initial_ast: 740946ba4379c80d6c5b63848b8738b8ec3c44c414ccbba68be7d321c86232b7 initial_ast: 772357946f6febbf75a72e8f706975abc242cc805368babdac1e3d047a1d0dc8
symbol_table: 1817d91b99941ddc2590c6a2777ad8f7d4ba26a8b2a3baa3932f1a08eb540206 symbol_table: 1817d91b99941ddc2590c6a2777ad8f7d4ba26a8b2a3baa3932f1a08eb540206

View File

@ -3,6 +3,6 @@ namespace: Compile
expectation: Pass expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: a183384b085186e92efdf0ccd221ba0f3de6e75cffc5610ed583ccd95aa4adcb - initial_input_ast: 00c3cc87ce3c30894ad6b6874ce6dacfa02c9f2bc171615ff627f06f2e201997
initial_ast: b6e75e27703bf6b6af69de95f9c22ef2033db46227f5658a9f2e88c33a169b1d initial_ast: b6e75e27703bf6b6af69de95f9c22ef2033db46227f5658a9f2e88c33a169b1d
symbol_table: fb66c9abb24c6c1bb79dd5fe9e9b78f293292fb3fab04ede561f866c6dc41f8c symbol_table: fb66c9abb24c6c1bb79dd5fe9e9b78f293292fb3fab04ede561f866c6dc41f8c

View File

@ -3,6 +3,6 @@ namespace: Compile
expectation: Pass expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: eed84b746db9633cd5314c8b23def7c95672f4696824e7504877baa8f62b52ac - initial_input_ast: c93f9fd667509aa0aa3896c261cb48c7d579d9856d0a14b96e9b2c7e04566a0a
initial_ast: b6e75e27703bf6b6af69de95f9c22ef2033db46227f5658a9f2e88c33a169b1d initial_ast: b6e75e27703bf6b6af69de95f9c22ef2033db46227f5658a9f2e88c33a169b1d
symbol_table: fb66c9abb24c6c1bb79dd5fe9e9b78f293292fb3fab04ede561f866c6dc41f8c symbol_table: fb66c9abb24c6c1bb79dd5fe9e9b78f293292fb3fab04ede561f866c6dc41f8c

View File

@ -2,4 +2,4 @@
namespace: Compile namespace: Compile
expectation: Fail expectation: Fail
outputs: outputs:
- "Error [ETYC0372002]: Found type `group` but type `scalar` was expected\n --> compiler-test:4:26\n |\n 4 | return (_, _)group * a;\n | ^\n" - "Error [ETYC0372003]: Found type `group` but type `scalar` was expected\n --> compiler-test:4:26\n |\n 4 | return (_, _)group * a;\n | ^\n"

View File

@ -3,6 +3,6 @@ namespace: Compile
expectation: Pass expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: 1c07a704862cbf7d7938c51d6d840c9ee713f3b6f661a60cca2a81ef3e55efa2 - initial_input_ast: 7b0236b04ad9caa4039a989b91e7f49021a9daf09a495a9cdad7c371ee196761
initial_ast: 0d225dc5aee0995ca7c84bdefd9be8fe473ea14876f55c4ac05f95c58b8393e6 initial_ast: 99e25dcd781ee8514ca93fdb34430f05caf429ed46dafa3189c3d835d680d7df
symbol_table: ae21cfdc16589d2cdf89c4aabece75367892087e76793cd0d7d62c9a04fa511c symbol_table: ae21cfdc16589d2cdf89c4aabece75367892087e76793cd0d7d62c9a04fa511c

View File

@ -3,6 +3,6 @@ namespace: Compile
expectation: Pass expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: c1a7cb2ec07ebfdcd1f7c0785b389e30ed16055a766d036354e52574a21fa8d9 - initial_input_ast: 5e1e23855cb6841ee210c8a24e11cc819e91ce3b087a8c961035c574baa1784b
initial_ast: 491aa1b9665527f07687444cb882f1ae5d363ca3b024f9cc3de36027ec37fce4 initial_ast: 491aa1b9665527f07687444cb882f1ae5d363ca3b024f9cc3de36027ec37fce4
symbol_table: 5f48052c64667bf793d8b6c22db7f867a88c1dfbb9341e53b970d6bb9bf3a11f symbol_table: 5f48052c64667bf793d8b6c22db7f867a88c1dfbb9341e53b970d6bb9bf3a11f

View File

@ -4,5 +4,5 @@ expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: no input - initial_input_ast: no input
initial_ast: ecc46ecae6d85317f8c1657c9653b7e39105b91aca6756df431f6a7bd203c10a initial_ast: 5a4b6b18074e63ba98467539a224838675ea3f08b945b554c23df2f22f730181
symbol_table: 1459210791fd0aae2827b2b7c3fd438e7a8315b290e23cbfe365b4214d5cd284 symbol_table: 1459210791fd0aae2827b2b7c3fd438e7a8315b290e23cbfe365b4214d5cd284

View File

@ -3,6 +3,6 @@ namespace: Compile
expectation: Pass expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: 2b6895ba1627e6a4dc444f814e2f6a0134ffdde243017e8dd23009081a15c95b - initial_input_ast: a60503e3f83fbee658d02fb3806b3a3326fc6d4f4e43ac05bce7b16ac0552edb
initial_ast: d454c467150c28dce64eb09e55df07e9467d34ce819e768414e8b101d174ae3b initial_ast: 07af6f05d46a6cd91085fb1aaf8a0fcb9cb2c05ccf60fd5fad5449e9fbf079b4
symbol_table: 3eec749e9dd6f72ae053f0af3753be405331fdf01739a80df8b1a90c03923d27 symbol_table: 3eec749e9dd6f72ae053f0af3753be405331fdf01739a80df8b1a90c03923d27

View File

@ -4,5 +4,5 @@ expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: no input - initial_input_ast: no input
initial_ast: 076729824ebf59b52b6ca66cc20cffcf311d7739738ed307af7936ba923c70ac initial_ast: 7031bc0fd844a95ff14f558d113c6c5701834489713c2e9050d42b80e32fa2d0
symbol_table: ac8c4425959cf548f2f0edc8aa637b1d827394f11fe2c10ecef366a803fe30a2 symbol_table: ac8c4425959cf548f2f0edc8aa637b1d827394f11fe2c10ecef366a803fe30a2

View File

@ -3,6 +3,6 @@ namespace: Compile
expectation: Pass expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: 2d76ce81281d5077442c5e6c12b13e536a037f0bb469492ecf0b77191b3ded14 - initial_input_ast: 1b5330a3356c437ddc09afc027d1365eedb24c56777772fd83b9167cfebb4435
initial_ast: 2989b1ba743c2fa15efe1ee5837ea2bf34dd19894799190387facdb1a4c0cdee initial_ast: c90971ebee1da3c277fef3288af860eeca4997ba9807a8038a3d1bd03200d277
symbol_table: b914736fbf23a1386a58c96fd9011214dd8a7393446dad3222c8551d8db979e6 symbol_table: b914736fbf23a1386a58c96fd9011214dd8a7393446dad3222c8551d8db979e6

View File

@ -4,5 +4,5 @@ expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: no input - initial_input_ast: no input
initial_ast: d6c9dc3a6a1f55be58c871ce0c2cd5df0c27756ce6f1502277293894b531e969 initial_ast: 32f2a58463cce89611be1ef90aa7f109f3c86c8c2ad87b11c4ab62127ac8c969
symbol_table: 7e69e6875d7b047f525e435533e6b299da0779cd28edbf4190f2b701c79d74fb symbol_table: 7e69e6875d7b047f525e435533e6b299da0779cd28edbf4190f2b701c79d74fb

View File

@ -3,6 +3,6 @@ namespace: Compile
expectation: Pass expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: f4e1b23f37abb9bcb386ddfd37ee066395d8e84f8ace0f4eb467264131e89fb0 - initial_input_ast: a28b88dc36ace78ed0de93b56db7274f16521597ccf1e820a17fdb60a1e3d92a
initial_ast: 97ab784d4cdbb80329f8284003c821fa956e5b4913277813136217849815200d initial_ast: 97ab784d4cdbb80329f8284003c821fa956e5b4913277813136217849815200d
symbol_table: 4bbffbffd675aec67af4ce2fbf803ec463900233ce1ad4049c7bb8092650859a symbol_table: 4bbffbffd675aec67af4ce2fbf803ec463900233ce1ad4049c7bb8092650859a

View File

@ -3,6 +3,6 @@ namespace: Compile
expectation: Pass expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: a18a82ee746e1fd1f9c6c09c36b055f9d3b44a17dd778c5081f9258d6bb9f3ae - initial_input_ast: d12e492b73a208051457ad2ce9ed8dbbb5a8096f32f52d697c41972ba8b88d35
initial_ast: bfe7dcd87fa958e67087b7b29d802e77ccb3001d9c487744867e7442628bbb60 initial_ast: 5d6e9ede195a3cfc06f7a91b47937247e6ffc237b57e37859a6d0e5cc966b762
symbol_table: 52a5d14e586868e2465abde3c15f47d151290737d408944c1474483e3050e399 symbol_table: 52a5d14e586868e2465abde3c15f47d151290737d408944c1474483e3050e399

View File

@ -4,5 +4,5 @@ expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: no input - initial_input_ast: no input
initial_ast: ba4bea7f4452a9a369ed5abb21cf7409f850125dff959f10ba211e50419f8d89 initial_ast: 3cf73b90d40fce8273b69ccf99424ad3b5f8fce2999d06bb1413428280f17f7d
symbol_table: f33f5b0c84aac58327880b146c570d74ed3118e93247b4a05680ae2c451db5b1 symbol_table: f33f5b0c84aac58327880b146c570d74ed3118e93247b4a05680ae2c451db5b1

View File

@ -4,5 +4,5 @@ expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: no input - initial_input_ast: no input
initial_ast: 5857efaf620a19b42463f90fc00a309a7c89c31e4a5b664b2bdd1c42161e777b initial_ast: 0ae122eb2bd121db2f072a8d79afbe3d0ad1023e7a4aaee2e4e9f4ba5c1a3c36
symbol_table: 2d0db26fa84f8daad71afd4420718043de1c97757ae4fe4fa78e9874891d1d80 symbol_table: 2d0db26fa84f8daad71afd4420718043de1c97757ae4fe4fa78e9874891d1d80

View File

@ -4,5 +4,5 @@ expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: no input - initial_input_ast: no input
initial_ast: 99888f61e01f330edf5125f530a706a2f059ad311f9ffe23c81e0aa1ea017ca9 initial_ast: 81f062d4ca72bbfb62d447cfe23d0658b3b40a4caf3ca1fd37db833a3a6ba9f5
symbol_table: c20979f64468655131a488980c1de31384fd7ff35561ed569c3db6f2d0bc19cc symbol_table: c20979f64468655131a488980c1de31384fd7ff35561ed569c3db6f2d0bc19cc

View File

@ -4,5 +4,5 @@ expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: no input - initial_input_ast: no input
initial_ast: 4063f3a3011beeb3e26e60b63f5f7f384aed795cf47525f8f472dea81a82745f initial_ast: 2b60be6820f8dc537b2ab9ec70e4981d93d0c68ebdc71d9437345e57c66505bf
symbol_table: f450d14b0bb862b0bec4a5f8d41eb92f7cf951dee469505fb20dbfa25972eb7b symbol_table: f450d14b0bb862b0bec4a5f8d41eb92f7cf951dee469505fb20dbfa25972eb7b

View File

@ -4,5 +4,5 @@ expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: no input - initial_input_ast: no input
initial_ast: 69ba2a183dfec5347e20a835d55b4d5e164f35f5491a9bbf1ddff9f5db45e8c6 initial_ast: c92281b28b5166cfa0cb458bb6f21dcc71d67dfe1f8bb757945c575cbb92a549
symbol_table: 52760622da95d189f6e707df97fc6bba4216fa59022a4ae79d840b9c05fdf5b1 symbol_table: 52760622da95d189f6e707df97fc6bba4216fa59022a4ae79d840b9c05fdf5b1

View File

@ -4,5 +4,5 @@ expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: no input - initial_input_ast: no input
initial_ast: ed195facf91180b4f72a7c005aab4b66d00200b19987e01c2ef3de59b20b5e57 initial_ast: b5c2ab86061f7dcae809f6a707559c1738a0f0a2352270ca3ff91a3242d70af3
symbol_table: d3bf69e78619e63bc1c56c1efe49712b226f5d477e1c42491d0b31e24d5a98a7 symbol_table: d3bf69e78619e63bc1c56c1efe49712b226f5d477e1c42491d0b31e24d5a98a7

View File

@ -4,5 +4,5 @@ expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: no input - initial_input_ast: no input
initial_ast: fd74afd5b64ad33e1e375b4db7d2f6aac7d8aaeb4406b97a8ccb3364b2129d5a initial_ast: 1d5f67161857e1ef3195099a1a04370ddf33dc3eebade9e1a5e0f6266c495a75
symbol_table: 026430e928e2236167d6587cb1885784f30bbc916f75d3a0f42fa7a3f2c6978b symbol_table: 026430e928e2236167d6587cb1885784f30bbc916f75d3a0f42fa7a3f2c6978b

View File

@ -4,5 +4,5 @@ expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: no input - initial_input_ast: no input
initial_ast: 0785d70c3be288aad6535bd949196a051c12b66b6f748008f84b2db69f68ace5 initial_ast: 31edb6eef4b9fa47acfb94f0f8f7ec9f50667501c7dc6bb5c643a65be90cbfb7
symbol_table: b181fa2d3c50419dbdaadbe2e91aa4a3e17baa614b0635f9ce6fa7367ead48eb symbol_table: b181fa2d3c50419dbdaadbe2e91aa4a3e17baa614b0635f9ce6fa7367ead48eb

View File

@ -3,6 +3,6 @@ namespace: Compile
expectation: Pass expectation: Pass
outputs: outputs:
- output: - output:
- initial_input_ast: 14d3cbbf97803da5b6c304e7b5ec5adcbb1583db29ba46aef485df97e7d54aaa - initial_input_ast: 23e62412d2a9377334d90aaeb6629b73c77e045ce87f23bd6ae2e2cd242e70f0
initial_ast: 0d2e5c56b05a5a8bc911fa071c3e2cf5bc9ebec76e9c881a19160068535d92bc initial_ast: 62a908a53573e228fec4b308f637909227856abaf327f527c23dd63e739d77d7
symbol_table: cac29305ef425fae4d6addd2f4718f0a5c17e9289e36ed0800f05029aec41725 symbol_table: cac29305ef425fae4d6addd2f4718f0a5c17e9289e36ed0800f05029aec41725

Some files were not shown because too many files have changed in this diff Show More