mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-12-26 19:51:52 +03:00
merge testnet3
This commit is contained in:
commit
fbf0a0aea9
@ -66,4 +66,10 @@
|
|||||||
|
|
||||||
# Run the transfer program.
|
# Run the transfer program.
|
||||||
$LEO run transfer
|
$LEO run transfer
|
||||||
|
)
|
||||||
|
|
||||||
|
# Build and run the two-adicity program.
|
||||||
|
(
|
||||||
|
cd ./project/examples/twoadicity || exit
|
||||||
|
$LEO run main
|
||||||
)
|
)
|
22
Cargo.lock
generated
22
Cargo.lock
generated
@ -74,7 +74,7 @@ version = "0.2.0"
|
|||||||
source = "git+https://github.com/AleoHQ/aleo.git?rev=4064f1c#4064f1cfbc612cdea8f5bcb8781453b3697abd27"
|
source = "git+https://github.com/AleoHQ/aleo.git?rev=4064f1c#4064f1cfbc612cdea8f5bcb8781453b3697abd27"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"clap 3.2.16",
|
"clap 3.2.17",
|
||||||
"colored",
|
"colored",
|
||||||
"rand",
|
"rand",
|
||||||
"rand_chacha",
|
"rand_chacha",
|
||||||
@ -160,9 +160,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anyhow"
|
name = "anyhow"
|
||||||
version = "1.0.60"
|
version = "1.0.61"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c794e162a5eff65c72ef524dfe393eb923c354e350bb78b9c7383df13f3bc142"
|
checksum = "508b352bb5c066aac251f6daf6b36eccd03e8a88e8081cd44959ea277a3af9a8"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "arrayref"
|
name = "arrayref"
|
||||||
@ -390,9 +390,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap"
|
name = "clap"
|
||||||
version = "3.2.16"
|
version = "3.2.17"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a3dbbb6653e7c55cc8595ad3e1f7be8f32aba4eb7ff7f0fd1163d4f3d137c0a9"
|
checksum = "29e724a68d9319343bb3328c9cc2dfde263f4b3142ee1059a9980580171c954b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"atty",
|
"atty",
|
||||||
"bitflags",
|
"bitflags",
|
||||||
@ -407,9 +407,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap_derive"
|
name = "clap_derive"
|
||||||
version = "3.2.15"
|
version = "3.2.17"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9ba52acd3b0a5c33aeada5cdaa3267cdc7c594a98731d4268cdc1532f4264cb4"
|
checksum = "13547f7012c01ab4a0e8f8967730ada8f9fdf419e8b6c792788f39cf4e46eefa"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"heck",
|
"heck",
|
||||||
"proc-macro-error",
|
"proc-macro-error",
|
||||||
@ -1195,7 +1195,7 @@ dependencies = [
|
|||||||
"ansi_term",
|
"ansi_term",
|
||||||
"assert_cmd",
|
"assert_cmd",
|
||||||
"backtrace",
|
"backtrace",
|
||||||
"clap 3.2.16",
|
"clap 3.2.17",
|
||||||
"color-backtrace",
|
"color-backtrace",
|
||||||
"colored",
|
"colored",
|
||||||
"console",
|
"console",
|
||||||
@ -1241,7 +1241,7 @@ dependencies = [
|
|||||||
name = "leo-parser"
|
name = "leo-parser"
|
||||||
version = "1.5.3"
|
version = "1.5.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap 3.2.16",
|
"clap 3.2.17",
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"leo-ast",
|
"leo-ast",
|
||||||
@ -1285,7 +1285,7 @@ name = "leo-test-framework"
|
|||||||
version = "1.5.3"
|
version = "1.5.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"backtrace",
|
"backtrace",
|
||||||
"clap 3.2.16",
|
"clap 3.2.17",
|
||||||
"criterion",
|
"criterion",
|
||||||
"leo-compiler",
|
"leo-compiler",
|
||||||
"leo-errors",
|
"leo-errors",
|
||||||
@ -2281,7 +2281,7 @@ version = "0.7.5"
|
|||||||
source = "git+https://github.com/AleoHQ/snarkVM.git?rev=22f3aa8#22f3aa8f566e1dfe80070ec4d78a1e55c72427dc"
|
source = "git+https://github.com/AleoHQ/snarkVM.git?rev=22f3aa8#22f3aa8f566e1dfe80070ec4d78a1e55c72427dc"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"clap 3.2.16",
|
"clap 3.2.17",
|
||||||
"colored",
|
"colored",
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
|
@ -14,10 +14,11 @@
|
|||||||
// 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 crate::{GroupLiteral, IntegerType};
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
// TODO: Refactor integer literals to use `IntegerType`.
|
||||||
/// A literal.
|
/// A literal.
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||||
pub enum Literal {
|
pub enum Literal {
|
||||||
@ -32,31 +33,13 @@ pub enum Literal {
|
|||||||
/// 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<GroupLiteral>),
|
Group(Box<GroupLiteral>),
|
||||||
|
/// An integer literal, e.g., `42`.
|
||||||
|
Integer(IntegerType, String, #[serde(with = "leo_span::span_json")] Span),
|
||||||
/// A scalar literal, e.g. `1scalar`.
|
/// A scalar literal, e.g. `1scalar`.
|
||||||
/// An unsigned number followed by the keyword `scalar`.
|
/// An unsigned number followed by the keyword `scalar`.
|
||||||
Scalar(String, #[serde(with = "leo_span::span_json")] Span),
|
Scalar(String, #[serde(with = "leo_span::span_json")] Span),
|
||||||
/// A string literal, e.g., `"foobar"`.
|
/// A string literal, e.g., `"foobar"`.
|
||||||
String(String, #[serde(with = "leo_span::span_json")] Span),
|
String(String, #[serde(with = "leo_span::span_json")] Span),
|
||||||
/// An 8-bit signed integer literal, e.g., `42i8`.
|
|
||||||
I8(String, #[serde(with = "leo_span::span_json")] Span),
|
|
||||||
/// A 16-bit signed integer literal, e.g., `42i16`.
|
|
||||||
I16(String, #[serde(with = "leo_span::span_json")] Span),
|
|
||||||
/// A 32-bit signed integer literal, e.g., `42i32`.
|
|
||||||
I32(String, #[serde(with = "leo_span::span_json")] Span),
|
|
||||||
/// A 64-bit signed integer literal, e.g., `42i64`.
|
|
||||||
I64(String, #[serde(with = "leo_span::span_json")] Span),
|
|
||||||
/// A 128-bit signed integer literal, e.g., `42i128`.
|
|
||||||
I128(String, #[serde(with = "leo_span::span_json")] Span),
|
|
||||||
/// A 8-bit unsigned integer literal, e.g., `42u8`.
|
|
||||||
U8(String, #[serde(with = "leo_span::span_json")] Span),
|
|
||||||
/// A 16-bit unsigned integer literal, e.g., `42u16`.
|
|
||||||
U16(String, #[serde(with = "leo_span::span_json")] Span),
|
|
||||||
/// A 32-bit unsigned integer literal, e.g., `42u32`.
|
|
||||||
U32(String, #[serde(with = "leo_span::span_json")] Span),
|
|
||||||
/// A 64-bit unsigned integer literal, e.g., `42u64`.
|
|
||||||
U64(String, #[serde(with = "leo_span::span_json")] Span),
|
|
||||||
/// A 128-bit unsigned integer literal, e.g., `42u128`.
|
|
||||||
U128(String, #[serde(with = "leo_span::span_json")] Span),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for Literal {
|
impl fmt::Display for Literal {
|
||||||
@ -64,20 +47,11 @@ impl fmt::Display for Literal {
|
|||||||
match &self {
|
match &self {
|
||||||
Self::Address(address, _) => write!(f, "{}", address),
|
Self::Address(address, _) => write!(f, "{}", address),
|
||||||
Self::Boolean(boolean, _) => write!(f, "{}", boolean),
|
Self::Boolean(boolean, _) => write!(f, "{}", boolean),
|
||||||
Self::I8(integer, _) => write!(f, "{}i8", integer),
|
|
||||||
Self::I16(integer, _) => write!(f, "{}i16", integer),
|
|
||||||
Self::I32(integer, _) => write!(f, "{}i32", integer),
|
|
||||||
Self::I64(integer, _) => write!(f, "{}i64", integer),
|
|
||||||
Self::I128(integer, _) => write!(f, "{}i128", integer),
|
|
||||||
Self::Field(field, _) => write!(f, "{}field", field),
|
Self::Field(field, _) => write!(f, "{}field", field),
|
||||||
Self::Group(group) => write!(f, "{}group", group),
|
Self::Group(group) => write!(f, "{}group", group),
|
||||||
|
Self::Integer(type_, value, _) => write!(f, "{}{}", value, type_),
|
||||||
Self::Scalar(scalar, _) => write!(f, "{}scalar", scalar),
|
Self::Scalar(scalar, _) => write!(f, "{}scalar", scalar),
|
||||||
Self::String(string, _) => write!(f, "{}", string),
|
Self::String(string, _) => write!(f, "{}", string),
|
||||||
Self::U8(integer, _) => write!(f, "{}u8", integer),
|
|
||||||
Self::U16(integer, _) => write!(f, "{}u16", integer),
|
|
||||||
Self::U32(integer, _) => write!(f, "{}u32", integer),
|
|
||||||
Self::U64(integer, _) => write!(f, "{}u64", integer),
|
|
||||||
Self::U128(integer, _) => write!(f, "{}u128", integer),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -88,18 +62,9 @@ impl Node for Literal {
|
|||||||
Self::Address(_, span)
|
Self::Address(_, span)
|
||||||
| Self::Boolean(_, span)
|
| Self::Boolean(_, span)
|
||||||
| Self::Field(_, span)
|
| Self::Field(_, span)
|
||||||
| Self::I8(_, span)
|
| Self::Integer(_, _, span)
|
||||||
| Self::I16(_, span)
|
|
||||||
| Self::I32(_, span)
|
|
||||||
| Self::I64(_, span)
|
|
||||||
| Self::I128(_, span)
|
|
||||||
| Self::Scalar(_, span)
|
| Self::Scalar(_, span)
|
||||||
| Self::String(_, span)
|
| Self::String(_, span) => *span,
|
||||||
| Self::U8(_, span)
|
|
||||||
| Self::U16(_, span)
|
|
||||||
| Self::U32(_, span)
|
|
||||||
| Self::U64(_, span)
|
|
||||||
| Self::U128(_, span) => *span,
|
|
||||||
Self::Group(group) => match &**group {
|
Self::Group(group) => match &**group {
|
||||||
GroupLiteral::Single(_, span) => *span,
|
GroupLiteral::Single(_, span) => *span,
|
||||||
GroupLiteral::Tuple(tuple) => tuple.span,
|
GroupLiteral::Tuple(tuple) => tuple.span,
|
||||||
@ -112,18 +77,9 @@ impl Node for Literal {
|
|||||||
Self::Address(_, span)
|
Self::Address(_, span)
|
||||||
| Self::Boolean(_, span)
|
| Self::Boolean(_, span)
|
||||||
| Self::Field(_, span)
|
| Self::Field(_, span)
|
||||||
| Self::I8(_, span)
|
| Self::Integer(_, _, span)
|
||||||
| Self::I16(_, span)
|
|
||||||
| Self::I32(_, span)
|
|
||||||
| Self::I64(_, span)
|
|
||||||
| Self::I128(_, span)
|
|
||||||
| Self::Scalar(_, span)
|
| Self::Scalar(_, span)
|
||||||
| Self::String(_, span)
|
| Self::String(_, span) => *span = new_span,
|
||||||
| Self::U8(_, span)
|
|
||||||
| Self::U16(_, span)
|
|
||||||
| Self::U32(_, span)
|
|
||||||
| Self::U64(_, span)
|
|
||||||
| Self::U128(_, span) => *span = new_span,
|
|
||||||
Self::Group(group) => match &mut **group {
|
Self::Group(group) => match &mut **group {
|
||||||
GroupLiteral::Single(_, span) => *span = new_span,
|
GroupLiteral::Single(_, span) => *span = new_span,
|
||||||
GroupLiteral::Tuple(tuple) => tuple.span = new_span,
|
GroupLiteral::Tuple(tuple) => tuple.span = new_span,
|
||||||
|
@ -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::{Expression, GroupLiteral, Literal, Node, Type, UnaryOperation};
|
use crate::{Expression, GroupLiteral, IntegerType, Literal, Node, Type, UnaryOperation};
|
||||||
use leo_errors::{InputError, LeoError, Result};
|
use leo_errors::{InputError, LeoError, Result};
|
||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
@ -26,16 +26,7 @@ pub enum InputValue {
|
|||||||
Boolean(bool),
|
Boolean(bool),
|
||||||
Field(String),
|
Field(String),
|
||||||
Group(GroupLiteral),
|
Group(GroupLiteral),
|
||||||
I8(String),
|
Integer(IntegerType, String),
|
||||||
I16(String),
|
|
||||||
I32(String),
|
|
||||||
I64(String),
|
|
||||||
I128(String),
|
|
||||||
U8(String),
|
|
||||||
U16(String),
|
|
||||||
U32(String),
|
|
||||||
U64(String),
|
|
||||||
U128(String),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TryFrom<(Type, Expression)> for InputValue {
|
impl TryFrom<(Type, Expression)> for InputValue {
|
||||||
@ -47,16 +38,13 @@ impl TryFrom<(Type, Expression)> for InputValue {
|
|||||||
(Type::Boolean, Literal::Boolean(value, _)) => Self::Boolean(value),
|
(Type::Boolean, Literal::Boolean(value, _)) => Self::Boolean(value),
|
||||||
(Type::Field, Literal::Field(value, _)) => Self::Field(value),
|
(Type::Field, Literal::Field(value, _)) => Self::Field(value),
|
||||||
(Type::Group, Literal::Group(value)) => Self::Group(*value),
|
(Type::Group, Literal::Group(value)) => Self::Group(*value),
|
||||||
(Type::I8, Literal::I8(value, _)) => Self::I8(value),
|
(Type::Integer(expected), Literal::Integer(actual, value, span)) => {
|
||||||
(Type::I16, Literal::I16(value, _)) => Self::I16(value),
|
if expected == actual {
|
||||||
(Type::I32, Literal::I32(value, _)) => Self::I32(value),
|
Self::Integer(expected, value)
|
||||||
(Type::I64, Literal::I64(value, _)) => Self::I64(value),
|
} else {
|
||||||
(Type::I128, Literal::I128(value, _)) => Self::I128(value),
|
return Err(InputError::unexpected_type(expected.to_string(), actual, span).into());
|
||||||
(Type::U8, Literal::U8(value, _)) => Self::U8(value),
|
}
|
||||||
(Type::U16, Literal::U16(value, _)) => Self::U16(value),
|
}
|
||||||
(Type::U32, Literal::U32(value, _)) => Self::U32(value),
|
|
||||||
(Type::U64, Literal::U64(value, _)) => Self::U64(value),
|
|
||||||
(Type::U128, Literal::U128(value, _)) => Self::U128(value),
|
|
||||||
(x, y) => {
|
(x, y) => {
|
||||||
return Err(InputError::unexpected_type(x, &y, y.span()).into());
|
return Err(InputError::unexpected_type(x, &y, y.span()).into());
|
||||||
}
|
}
|
||||||
@ -76,16 +64,7 @@ impl fmt::Display for InputValue {
|
|||||||
InputValue::Boolean(ref boolean) => write!(f, "{}", boolean),
|
InputValue::Boolean(ref boolean) => write!(f, "{}", boolean),
|
||||||
InputValue::Group(ref group) => write!(f, "{}", group),
|
InputValue::Group(ref group) => write!(f, "{}", group),
|
||||||
InputValue::Field(ref field) => write!(f, "{}", field),
|
InputValue::Field(ref field) => write!(f, "{}", field),
|
||||||
InputValue::I8(ref integer) => write!(f, "{}", integer),
|
InputValue::Integer(ref type_, ref number) => write!(f, "{}{:?}", number, type_),
|
||||||
InputValue::I16(ref integer) => write!(f, "{}", integer),
|
|
||||||
InputValue::I32(ref integer) => write!(f, "{}", integer),
|
|
||||||
InputValue::I64(ref integer) => write!(f, "{}", integer),
|
|
||||||
InputValue::I128(ref integer) => write!(f, "{}", integer),
|
|
||||||
InputValue::U8(ref integer) => write!(f, "{}", integer),
|
|
||||||
InputValue::U16(ref integer) => write!(f, "{}", integer),
|
|
||||||
InputValue::U32(ref integer) => write!(f, "{}", integer),
|
|
||||||
InputValue::U64(ref integer) => write!(f, "{}", integer),
|
|
||||||
InputValue::U128(ref integer) => write!(f, "{}", integer),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
78
compiler/ast/src/types/integer_type.rs
Normal file
78
compiler/ast/src/types/integer_type.rs
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
// 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 leo_span::{sym, Symbol};
|
||||||
|
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
use std::fmt;
|
||||||
|
|
||||||
|
/// Explicit integer type.
|
||||||
|
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||||
|
pub enum IntegerType {
|
||||||
|
U8,
|
||||||
|
U16,
|
||||||
|
U32,
|
||||||
|
U64,
|
||||||
|
U128,
|
||||||
|
|
||||||
|
I8,
|
||||||
|
I16,
|
||||||
|
I32,
|
||||||
|
I64,
|
||||||
|
I128,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl IntegerType {
|
||||||
|
/// Is the integer type a signed one?
|
||||||
|
pub fn is_signed(&self) -> bool {
|
||||||
|
use IntegerType::*;
|
||||||
|
matches!(self, I8 | I16 | I32 | I64 | I128)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns the symbol for the integer type.
|
||||||
|
pub fn symbol(self) -> Symbol {
|
||||||
|
match self {
|
||||||
|
Self::I8 => sym::i8,
|
||||||
|
Self::I16 => sym::i16,
|
||||||
|
Self::I32 => sym::i32,
|
||||||
|
Self::I64 => sym::i64,
|
||||||
|
Self::I128 => sym::i128,
|
||||||
|
Self::U8 => sym::u8,
|
||||||
|
Self::U16 => sym::u16,
|
||||||
|
Self::U32 => sym::u32,
|
||||||
|
Self::U64 => sym::u64,
|
||||||
|
Self::U128 => sym::u128,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for IntegerType {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
match *self {
|
||||||
|
IntegerType::U8 => write!(f, "u8"),
|
||||||
|
IntegerType::U16 => write!(f, "u16"),
|
||||||
|
IntegerType::U32 => write!(f, "u32"),
|
||||||
|
IntegerType::U64 => write!(f, "u64"),
|
||||||
|
IntegerType::U128 => write!(f, "u128"),
|
||||||
|
|
||||||
|
IntegerType::I8 => write!(f, "i8"),
|
||||||
|
IntegerType::I16 => write!(f, "i16"),
|
||||||
|
IntegerType::I32 => write!(f, "i32"),
|
||||||
|
IntegerType::I64 => write!(f, "i64"),
|
||||||
|
IntegerType::I128 => write!(f, "i128"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -14,6 +14,9 @@
|
|||||||
// 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/>.
|
||||||
|
|
||||||
|
pub mod integer_type;
|
||||||
|
pub use integer_type::*;
|
||||||
|
|
||||||
pub mod tuple;
|
pub mod tuple;
|
||||||
pub use tuple::*;
|
pub use tuple::*;
|
||||||
|
|
||||||
|
@ -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::{Identifier, Tuple};
|
use crate::{Identifier, IntegerType, Tuple};
|
||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
@ -31,35 +31,16 @@ pub enum Type {
|
|||||||
Field,
|
Field,
|
||||||
/// The `group` type.
|
/// The `group` type.
|
||||||
Group,
|
Group,
|
||||||
/// The 8-bit signed integer type.
|
|
||||||
I8,
|
|
||||||
/// The 16-bit signed integer type.
|
|
||||||
I16,
|
|
||||||
/// The 32-bit signed integer type.
|
|
||||||
I32,
|
|
||||||
/// The 64-bit signed integer type.
|
|
||||||
I64,
|
|
||||||
/// The 128-bit signed integer type.
|
|
||||||
I128,
|
|
||||||
/// A reference to a built in type.
|
/// A reference to a built in type.
|
||||||
Identifier(Identifier),
|
Identifier(Identifier),
|
||||||
|
/// An integer type.
|
||||||
|
Integer(IntegerType),
|
||||||
/// The `scalar` type.
|
/// The `scalar` type.
|
||||||
Scalar,
|
Scalar,
|
||||||
/// The `string` type.
|
/// The `string` type.
|
||||||
String,
|
String,
|
||||||
/// The 8-bit unsigned integer type.
|
|
||||||
U8,
|
|
||||||
/// The 16-bit unsigned integer type.
|
|
||||||
U16,
|
|
||||||
/// The 32-bit unsigned integer type.
|
|
||||||
U32,
|
|
||||||
/// The 64-bit unsigned integer type.
|
|
||||||
U64,
|
|
||||||
/// The 128-bit unsigned integer type.
|
|
||||||
U128,
|
|
||||||
/// A static tuple of at least one type.
|
/// A static tuple of at least one type.
|
||||||
Tuple(Tuple),
|
Tuple(Tuple),
|
||||||
|
|
||||||
/// Placeholder for a type that could not be resolved or was not well-formed.
|
/// Placeholder for a type that could not be resolved or was not well-formed.
|
||||||
/// Will eventually lead to a compile error.
|
/// Will eventually lead to a compile error.
|
||||||
Err,
|
Err,
|
||||||
@ -77,18 +58,9 @@ impl Type {
|
|||||||
| (Type::Boolean, Type::Boolean)
|
| (Type::Boolean, Type::Boolean)
|
||||||
| (Type::Field, Type::Field)
|
| (Type::Field, Type::Field)
|
||||||
| (Type::Group, Type::Group)
|
| (Type::Group, Type::Group)
|
||||||
| (Type::I8, Type::I8)
|
|
||||||
| (Type::I16, Type::I16)
|
|
||||||
| (Type::I32, Type::I32)
|
|
||||||
| (Type::I64, Type::I64)
|
|
||||||
| (Type::I128, Type::I128)
|
|
||||||
| (Type::Scalar, Type::Scalar)
|
| (Type::Scalar, Type::Scalar)
|
||||||
| (Type::String, Type::String)
|
| (Type::String, Type::String) => true,
|
||||||
| (Type::U8, Type::U8)
|
(Type::Integer(left), Type::Integer(right)) => left.eq(right),
|
||||||
| (Type::U16, Type::U16)
|
|
||||||
| (Type::U32, Type::U32)
|
|
||||||
| (Type::U64, Type::U64)
|
|
||||||
| (Type::U128, Type::U128) => true,
|
|
||||||
(Type::Tuple(left), Type::Tuple(right)) => left
|
(Type::Tuple(left), Type::Tuple(right)) => left
|
||||||
.iter()
|
.iter()
|
||||||
.zip(right.iter())
|
.zip(right.iter())
|
||||||
@ -106,19 +78,10 @@ impl fmt::Display for Type {
|
|||||||
Type::Boolean => write!(f, "boolean"),
|
Type::Boolean => write!(f, "boolean"),
|
||||||
Type::Field => write!(f, "field"),
|
Type::Field => write!(f, "field"),
|
||||||
Type::Group => write!(f, "group"),
|
Type::Group => write!(f, "group"),
|
||||||
Type::I8 => write!(f, "i8"),
|
Type::Identifier(ref variable) => write!(f, "circuit {}", variable),
|
||||||
Type::I16 => write!(f, "i16"),
|
Type::Integer(ref integer_type) => write!(f, "{}", integer_type),
|
||||||
Type::I32 => write!(f, "i32"),
|
|
||||||
Type::I64 => write!(f, "i64"),
|
|
||||||
Type::I128 => write!(f, "i128"),
|
|
||||||
Type::Identifier(ref variable) => write!(f, "{}", variable),
|
|
||||||
Type::Scalar => write!(f, "scalar"),
|
Type::Scalar => write!(f, "scalar"),
|
||||||
Type::String => write!(f, "string"),
|
Type::String => write!(f, "string"),
|
||||||
Type::U8 => write!(f, "u8"),
|
|
||||||
Type::U16 => write!(f, "u16"),
|
|
||||||
Type::U32 => write!(f, "u32"),
|
|
||||||
Type::U64 => write!(f, "u64"),
|
|
||||||
Type::U128 => write!(f, "u128"),
|
|
||||||
Type::Tuple(ref tuple) => write!(f, "{}", tuple),
|
Type::Tuple(ref tuple) => write!(f, "{}", tuple),
|
||||||
Type::Err => write!(f, "error"),
|
Type::Err => write!(f, "error"),
|
||||||
}
|
}
|
||||||
|
@ -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::{GroupLiteral, Identifier, Literal, Type};
|
use crate::{GroupLiteral, Identifier, IntegerType, Literal, Type};
|
||||||
|
|
||||||
use leo_errors::{type_name, FlattenError, LeoError, Result};
|
use leo_errors::{type_name, FlattenError, LeoError, Result};
|
||||||
use leo_span::{Span, Symbol};
|
use leo_span::{Span, Symbol};
|
||||||
@ -848,16 +848,16 @@ impl From<&Value> for Type {
|
|||||||
Circuit(ident, _) => Type::Identifier(*ident),
|
Circuit(ident, _) => Type::Identifier(*ident),
|
||||||
Field(_, _) => Type::Field,
|
Field(_, _) => Type::Field,
|
||||||
Group(_) => Type::Group,
|
Group(_) => Type::Group,
|
||||||
I8(_, _) => Type::I8,
|
I8(_, _) => Type::Integer(IntegerType::I8),
|
||||||
I16(_, _) => Type::I16,
|
I16(_, _) => Type::Integer(IntegerType::I16),
|
||||||
I32(_, _) => Type::I32,
|
I32(_, _) => Type::Integer(IntegerType::I32),
|
||||||
I64(_, _) => Type::I64,
|
I64(_, _) => Type::Integer(IntegerType::I64),
|
||||||
I128(_, _) => Type::I128,
|
I128(_, _) => Type::Integer(IntegerType::I128),
|
||||||
U8(_, _) => Type::U8,
|
U8(_, _) => Type::Integer(IntegerType::U8),
|
||||||
U16(_, _) => Type::U16,
|
U16(_, _) => Type::Integer(IntegerType::U16),
|
||||||
U32(_, _) => Type::U32,
|
U32(_, _) => Type::Integer(IntegerType::U32),
|
||||||
U64(_, _) => Type::U64,
|
U64(_, _) => Type::Integer(IntegerType::U64),
|
||||||
U128(_, _) => Type::U128,
|
U128(_, _) => Type::Integer(IntegerType::U128),
|
||||||
Scalar(_, _) => Type::Scalar,
|
Scalar(_, _) => Type::Scalar,
|
||||||
String(_, _) => Type::String,
|
String(_, _) => Type::String,
|
||||||
}
|
}
|
||||||
@ -876,16 +876,18 @@ impl From<&Literal> for Value {
|
|||||||
Literal::Group(group_literal) => Self::Group(group_literal.clone()),
|
Literal::Group(group_literal) => Self::Group(group_literal.clone()),
|
||||||
Literal::Scalar(string, span) => Self::Scalar(string.clone(), *span),
|
Literal::Scalar(string, span) => Self::Scalar(string.clone(), *span),
|
||||||
Literal::String(string, span) => Self::String(string.clone(), *span),
|
Literal::String(string, span) => Self::String(string.clone(), *span),
|
||||||
Literal::I8(string, span) => Self::I8(string.parse::<i8>().unwrap(), *span),
|
Literal::Integer(integer_type, string, span) => match integer_type {
|
||||||
Literal::I16(string, span) => Self::I16(string.parse::<i16>().unwrap(), *span),
|
IntegerType::U8 => Self::U8(string.parse().unwrap(), *span),
|
||||||
Literal::I32(string, span) => Self::I32(string.parse::<i32>().unwrap(), *span),
|
IntegerType::U16 => Self::U16(string.parse().unwrap(), *span),
|
||||||
Literal::I64(string, span) => Self::I64(string.parse::<i64>().unwrap(), *span),
|
IntegerType::U32 => Self::U32(string.parse().unwrap(), *span),
|
||||||
Literal::I128(string, span) => Self::I128(string.parse::<i128>().unwrap(), *span),
|
IntegerType::U64 => Self::U64(string.parse().unwrap(), *span),
|
||||||
Literal::U8(string, span) => Self::U8(string.parse::<u8>().unwrap(), *span),
|
IntegerType::U128 => Self::U128(string.parse().unwrap(), *span),
|
||||||
Literal::U16(string, span) => Self::U16(string.parse::<u16>().unwrap(), *span),
|
IntegerType::I8 => Self::I8(string.parse().unwrap(), *span),
|
||||||
Literal::U32(string, span) => Self::U32(string.parse::<u32>().unwrap(), *span),
|
IntegerType::I16 => Self::I16(string.parse().unwrap(), *span),
|
||||||
Literal::U64(string, span) => Self::U64(string.parse::<u64>().unwrap(), *span),
|
IntegerType::I32 => Self::I32(string.parse().unwrap(), *span),
|
||||||
Literal::U128(string, span) => Self::U128(string.parse::<u128>().unwrap(), *span),
|
IntegerType::I64 => Self::I64(string.parse().unwrap(), *span),
|
||||||
|
IntegerType::I128 => Self::I128(string.parse().unwrap(), *span),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -900,16 +902,16 @@ impl From<Value> for Literal {
|
|||||||
Circuit(_ident, _values) => todo!("We need to test if this is hittable"),
|
Circuit(_ident, _values) => todo!("We need to test if this is hittable"),
|
||||||
Field(v, span) => Literal::Field(v, span),
|
Field(v, span) => Literal::Field(v, span),
|
||||||
Group(v) => Literal::Group(v),
|
Group(v) => Literal::Group(v),
|
||||||
I8(v, span) => Literal::I8(v.to_string(), span),
|
I8(v, span) => Literal::Integer(IntegerType::I8, v.to_string(), span),
|
||||||
I16(v, span) => Literal::I16(v.to_string(), span),
|
I16(v, span) => Literal::Integer(IntegerType::I16, v.to_string(), span),
|
||||||
I32(v, span) => Literal::I32(v.to_string(), span),
|
I32(v, span) => Literal::Integer(IntegerType::I32, v.to_string(), span),
|
||||||
I64(v, span) => Literal::I64(v.to_string(), span),
|
I64(v, span) => Literal::Integer(IntegerType::I64, v.to_string(), span),
|
||||||
I128(v, span) => Literal::I128(v.to_string(), span),
|
I128(v, span) => Literal::Integer(IntegerType::I128, v.to_string(), span),
|
||||||
U8(v, span) => Literal::U8(v.to_string(), span),
|
U8(v, span) => Literal::Integer(IntegerType::U8, v.to_string(), span),
|
||||||
U16(v, span) => Literal::U16(v.to_string(), span),
|
U16(v, span) => Literal::Integer(IntegerType::U16, v.to_string(), span),
|
||||||
U32(v, span) => Literal::U32(v.to_string(), span),
|
U32(v, span) => Literal::Integer(IntegerType::U32, v.to_string(), span),
|
||||||
U64(v, span) => Literal::U64(v.to_string(), span),
|
U64(v, span) => Literal::Integer(IntegerType::U64, v.to_string(), span),
|
||||||
U128(v, span) => Literal::U128(v.to_string(), span),
|
U128(v, span) => Literal::Integer(IntegerType::U128, v.to_string(), span),
|
||||||
Scalar(v, span) => Literal::Scalar(v, span),
|
Scalar(v, span) => Literal::Scalar(v, span),
|
||||||
String(v, span) => Literal::String(v, span),
|
String(v, span) => Literal::String(v, span),
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ pub use pedersen::*;
|
|||||||
mod poseidon;
|
mod poseidon;
|
||||||
pub use poseidon::*;
|
pub use poseidon::*;
|
||||||
|
|
||||||
use leo_ast::Type;
|
use leo_ast::{IntegerType, Type};
|
||||||
use leo_span::{sym, Symbol};
|
use leo_span::{sym, Symbol};
|
||||||
|
|
||||||
/// A core instruction that maps directly to an AVM bytecode instruction.
|
/// A core instruction that maps directly to an AVM bytecode instruction.
|
||||||
@ -188,44 +188,44 @@ const ALL_TYPES: [Type; 16] = [
|
|||||||
Type::Boolean,
|
Type::Boolean,
|
||||||
Type::Field,
|
Type::Field,
|
||||||
Type::Group,
|
Type::Group,
|
||||||
Type::I8,
|
Type::Integer(IntegerType::I8),
|
||||||
Type::I16,
|
Type::Integer(IntegerType::I16),
|
||||||
Type::I32,
|
Type::Integer(IntegerType::I32),
|
||||||
Type::I64,
|
Type::Integer(IntegerType::I64),
|
||||||
Type::I128,
|
Type::Integer(IntegerType::I128),
|
||||||
Type::U8,
|
Type::Integer(IntegerType::U8),
|
||||||
Type::U16,
|
Type::Integer(IntegerType::U16),
|
||||||
Type::U32,
|
Type::Integer(IntegerType::U32),
|
||||||
Type::U64,
|
Type::Integer(IntegerType::U64),
|
||||||
Type::U128,
|
Type::Integer(IntegerType::U128),
|
||||||
Type::Scalar,
|
Type::Scalar,
|
||||||
Type::String,
|
Type::String,
|
||||||
];
|
];
|
||||||
|
|
||||||
const BOOL_INT_STRING_TYPES: [Type; 12] = [
|
const BOOL_INT_STRING_TYPES: [Type; 12] = [
|
||||||
Type::Boolean,
|
Type::Boolean,
|
||||||
Type::I8,
|
Type::Integer(IntegerType::I8),
|
||||||
Type::I16,
|
Type::Integer(IntegerType::I16),
|
||||||
Type::I32,
|
Type::Integer(IntegerType::I32),
|
||||||
Type::I64,
|
Type::Integer(IntegerType::I64),
|
||||||
Type::I128,
|
Type::Integer(IntegerType::I128),
|
||||||
Type::U8,
|
Type::Integer(IntegerType::U8),
|
||||||
Type::U16,
|
Type::Integer(IntegerType::U16),
|
||||||
Type::U32,
|
Type::Integer(IntegerType::U32),
|
||||||
Type::U64,
|
Type::Integer(IntegerType::U64),
|
||||||
Type::U128,
|
Type::Integer(IntegerType::U128),
|
||||||
Type::String,
|
Type::String,
|
||||||
];
|
];
|
||||||
|
|
||||||
const BOOL_INT64_STRING_TYPES: [Type; 10] = [
|
const BOOL_INT64_STRING_TYPES: [Type; 10] = [
|
||||||
Type::Boolean,
|
Type::Boolean,
|
||||||
Type::I8,
|
Type::Integer(IntegerType::I8),
|
||||||
Type::I16,
|
Type::Integer(IntegerType::I16),
|
||||||
Type::I32,
|
Type::Integer(IntegerType::I32),
|
||||||
Type::I64,
|
Type::Integer(IntegerType::I64),
|
||||||
Type::U8,
|
Type::Integer(IntegerType::U8),
|
||||||
Type::U16,
|
Type::Integer(IntegerType::U16),
|
||||||
Type::U32,
|
Type::Integer(IntegerType::U32),
|
||||||
Type::U64,
|
Type::Integer(IntegerType::U64),
|
||||||
Type::String,
|
Type::String,
|
||||||
];
|
];
|
||||||
|
@ -250,13 +250,28 @@ impl ParserContext<'_> {
|
|||||||
};
|
};
|
||||||
ops.push((operation, self.prev_token.span));
|
ops.push((operation, self.prev_token.span));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This is needed to ensure that only the token sequence `-`, `Token::Integer(..)` is parsed as a negative integer literal.
|
||||||
|
let inner_is_integer = matches!(self.token.token, Token::Integer(..));
|
||||||
|
|
||||||
let mut inner = self.parse_postfix_expression()?;
|
let mut inner = self.parse_postfix_expression()?;
|
||||||
for (op, op_span) in ops.into_iter().rev() {
|
for (op, op_span) in ops.into_iter().rev() {
|
||||||
inner = Expression::Unary(UnaryExpression {
|
inner = match inner {
|
||||||
span: op_span + inner.span(),
|
// If the unary operation is a negate, and the inner expression is a signed integer literal,
|
||||||
op,
|
// then produce a negative integer literal.
|
||||||
receiver: Box::new(inner),
|
// This helps handle a special case where -128i8, treated as a unary expression, overflows, but -128i8, treated as an integer literal doesn't.
|
||||||
});
|
Expression::Literal(Literal::Integer(integer_type, string, span))
|
||||||
|
if op == UnaryOperation::Negate && inner_is_integer =>
|
||||||
|
{
|
||||||
|
Expression::Literal(Literal::Integer(integer_type, format!("-{}", string), op_span + span))
|
||||||
|
}
|
||||||
|
// Otherwise, produce a unary expression.
|
||||||
|
_ => Expression::Unary(UnaryExpression {
|
||||||
|
span: op_span + inner.span(),
|
||||||
|
op,
|
||||||
|
receiver: Box::new(inner),
|
||||||
|
}),
|
||||||
|
};
|
||||||
}
|
}
|
||||||
Ok(inner)
|
Ok(inner)
|
||||||
}
|
}
|
||||||
@ -536,19 +551,8 @@ impl ParserContext<'_> {
|
|||||||
// 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())?;
|
||||||
match suffix {
|
let int_ty = Self::token_to_int_type(suffix).expect("unknown int type token");
|
||||||
Token::I8 => Expression::Literal(Literal::I8(value, full_span)),
|
Expression::Literal(Literal::Integer(int_ty, value, full_span))
|
||||||
Token::I16 => Expression::Literal(Literal::I16(value, full_span)),
|
|
||||||
Token::I32 => Expression::Literal(Literal::I32(value, full_span)),
|
|
||||||
Token::I64 => Expression::Literal(Literal::I64(value, full_span)),
|
|
||||||
Token::I128 => Expression::Literal(Literal::I128(value, full_span)),
|
|
||||||
Token::U8 => Expression::Literal(Literal::U8(value, full_span)),
|
|
||||||
Token::U16 => Expression::Literal(Literal::U16(value, full_span)),
|
|
||||||
Token::U32 => Expression::Literal(Literal::U32(value, full_span)),
|
|
||||||
Token::U64 => Expression::Literal(Literal::U64(value, full_span)),
|
|
||||||
Token::U128 => Expression::Literal(Literal::U128(value, full_span)),
|
|
||||||
_ => return Err(ParserError::unexpected_token("Expected integer type suffix", span).into()),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
None => return Err(ParserError::implicit_values_not_allowed(value, span).into()),
|
None => return Err(ParserError::implicit_values_not_allowed(value, span).into()),
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
use leo_errors::{ParserError, Result};
|
use leo_errors::Result;
|
||||||
|
|
||||||
pub(super) const TYPE_TOKENS: &[Token] = &[
|
pub(super) const TYPE_TOKENS: &[Token] = &[
|
||||||
Token::Address,
|
Token::Address,
|
||||||
@ -38,29 +38,39 @@ pub(super) const TYPE_TOKENS: &[Token] = &[
|
|||||||
];
|
];
|
||||||
|
|
||||||
impl ParserContext<'_> {
|
impl ParserContext<'_> {
|
||||||
|
/// Returns a [`IntegerType`] AST node if the given token is a supported integer type, or [`None`].
|
||||||
|
pub(super) fn token_to_int_type(token: &Token) -> Option<IntegerType> {
|
||||||
|
Some(match token {
|
||||||
|
Token::I8 => IntegerType::I8,
|
||||||
|
Token::I16 => IntegerType::I16,
|
||||||
|
Token::I32 => IntegerType::I32,
|
||||||
|
Token::I64 => IntegerType::I64,
|
||||||
|
Token::I128 => IntegerType::I128,
|
||||||
|
Token::U8 => IntegerType::U8,
|
||||||
|
Token::U16 => IntegerType::U16,
|
||||||
|
Token::U32 => IntegerType::U32,
|
||||||
|
Token::U64 => IntegerType::U64,
|
||||||
|
Token::U128 => IntegerType::U128,
|
||||||
|
_ => return None,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns a [`(Type, Span)`] tuple of AST nodes if the next token represents a primitive type.
|
/// Returns a [`(Type, Span)`] tuple of AST nodes if the next token represents a primitive type.
|
||||||
/// Also returns the span of the parsed token.
|
/// Also returns the span of the parsed token.
|
||||||
pub fn parse_primitive_type(&mut self) -> Result<(Type, Span)> {
|
pub fn parse_primitive_type(&mut self) -> Result<(Type, Span)> {
|
||||||
let span = self.expect_any(TYPE_TOKENS)?;
|
let span = self.expect_any(TYPE_TOKENS)?;
|
||||||
match &self.prev_token.token {
|
Ok((
|
||||||
Token::Address => Ok((Type::Address, span)),
|
match &self.prev_token.token {
|
||||||
Token::Bool => Ok((Type::Boolean, span)),
|
Token::Address => Type::Address,
|
||||||
Token::Field => Ok((Type::Field, span)),
|
Token::Bool => Type::Boolean,
|
||||||
Token::Group => Ok((Type::Group, span)),
|
Token::Field => Type::Field,
|
||||||
Token::I8 => Ok((Type::I8, span)),
|
Token::Group => Type::Group,
|
||||||
Token::I16 => Ok((Type::I16, span)),
|
Token::Scalar => Type::Scalar,
|
||||||
Token::I32 => Ok((Type::I32, span)),
|
Token::String => Type::String,
|
||||||
Token::I64 => Ok((Type::I64, span)),
|
x => Type::Integer(Self::token_to_int_type(x).expect("invalid int type")),
|
||||||
Token::I128 => Ok((Type::I128, span)),
|
},
|
||||||
Token::Scalar => Ok((Type::Scalar, span)),
|
span,
|
||||||
Token::String => Ok((Type::String, span)),
|
))
|
||||||
Token::U8 => Ok((Type::U8, span)),
|
|
||||||
Token::U16 => Ok((Type::U16, span)),
|
|
||||||
Token::U32 => Ok((Type::U32, span)),
|
|
||||||
Token::U64 => Ok((Type::U64, span)),
|
|
||||||
Token::U128 => Ok((Type::U128, span)),
|
|
||||||
_ => Err(ParserError::unexpected_token("Expected a primitive type.", span).into()),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a [`(Type, Span)`] tuple of AST nodes if the next token represents a type.
|
/// Returns a [`(Type, Span)`] tuple of AST nodes if the next token represents a type.
|
||||||
|
@ -28,16 +28,7 @@ impl<'a> CodeGenerator<'a> {
|
|||||||
| Type::Group
|
| Type::Group
|
||||||
| Type::Scalar
|
| Type::Scalar
|
||||||
| Type::String
|
| Type::String
|
||||||
| Type::I8
|
| Type::Integer(..) => format!("{}", input),
|
||||||
| Type::I16
|
|
||||||
| Type::I32
|
|
||||||
| Type::I64
|
|
||||||
| Type::I128
|
|
||||||
| Type::U8
|
|
||||||
| Type::U16
|
|
||||||
| Type::U32
|
|
||||||
| Type::U64
|
|
||||||
| Type::U128 => format!("{}", input),
|
|
||||||
Type::Identifier(ident) => {
|
Type::Identifier(ident) => {
|
||||||
if let Some((_, type_)) = self.composite_mapping.get(&ident.name) {
|
if let Some((_, type_)) = self.composite_mapping.get(&ident.name) {
|
||||||
format!("{}.{}", ident.to_string().to_lowercase(), type_)
|
format!("{}.{}", ident.to_string().to_lowercase(), type_)
|
||||||
|
@ -51,16 +51,20 @@ impl StatementReconstructor for Unroller<'_> {
|
|||||||
input.stop_value.clone().into_inner(),
|
input.stop_value.clone().into_inner(),
|
||||||
) {
|
) {
|
||||||
(Some(start), Some(stop)) => match (Type::from(&start), Type::from(&stop)) {
|
(Some(start), Some(stop)) => match (Type::from(&start), Type::from(&stop)) {
|
||||||
(Type::I8, Type::I8)
|
(Type::Integer(IntegerType::I8), Type::Integer(IntegerType::I8))
|
||||||
| (Type::I16, Type::I16)
|
| (Type::Integer(IntegerType::I16), Type::Integer(IntegerType::I16))
|
||||||
| (Type::I32, Type::I32)
|
| (Type::Integer(IntegerType::I32), Type::Integer(IntegerType::I32))
|
||||||
| (Type::I64, Type::I64)
|
| (Type::Integer(IntegerType::I64), Type::Integer(IntegerType::I64))
|
||||||
| (Type::I128, Type::I128) => self.unroll_iteration_statement::<i128>(input, start, stop),
|
| (Type::Integer(IntegerType::I128), Type::Integer(IntegerType::I128)) => {
|
||||||
(Type::U8, Type::U8)
|
self.unroll_iteration_statement::<i128>(input, start, stop)
|
||||||
| (Type::U16, Type::U16)
|
}
|
||||||
| (Type::U32, Type::U32)
|
(Type::Integer(IntegerType::U8), Type::Integer(IntegerType::U8))
|
||||||
| (Type::U64, Type::U64)
|
| (Type::Integer(IntegerType::U16), Type::Integer(IntegerType::U16))
|
||||||
| (Type::U128, Type::U128) => self.unroll_iteration_statement::<u128>(input, start, stop),
|
| (Type::Integer(IntegerType::U32), Type::Integer(IntegerType::U32))
|
||||||
|
| (Type::Integer(IntegerType::U64), Type::Integer(IntegerType::U64))
|
||||||
|
| (Type::Integer(IntegerType::U128), Type::Integer(IntegerType::U128)) => {
|
||||||
|
self.unroll_iteration_statement::<u128>(input, start, stop)
|
||||||
|
}
|
||||||
_ => unreachable!("Type checking ensures that `start` and `stop` have the same type."),
|
_ => unreachable!("Type checking ensures that `start` and `stop` have the same type."),
|
||||||
},
|
},
|
||||||
// If both loop bounds are not constant, then the loop is not unrolled.
|
// If both loop bounds are not constant, then the loop is not unrolled.
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
// 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 leo_ast::{
|
use leo_ast::{
|
||||||
Block, DeclarationType, DefinitionStatement, Expression, IterationStatement, Literal, Statement,
|
Block, DeclarationType, DefinitionStatement, Expression, IntegerType, IterationStatement, Literal, Statement,
|
||||||
StatementReconstructor, Type, Value,
|
StatementReconstructor, Type, Value,
|
||||||
};
|
};
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
@ -149,16 +149,36 @@ impl<'a> Unroller<'a> {
|
|||||||
|
|
||||||
// Reconstruct `iteration_count` as a `Literal`.
|
// Reconstruct `iteration_count` as a `Literal`.
|
||||||
let value = match input.type_ {
|
let value = match input.type_ {
|
||||||
Type::I8 => Literal::I8(iteration_count.to_string(), Default::default()),
|
Type::Integer(IntegerType::I8) => {
|
||||||
Type::I16 => Literal::I16(iteration_count.to_string(), Default::default()),
|
Literal::Integer(IntegerType::I8, iteration_count.to_string(), Default::default())
|
||||||
Type::I32 => Literal::I32(iteration_count.to_string(), Default::default()),
|
}
|
||||||
Type::I64 => Literal::I64(iteration_count.to_string(), Default::default()),
|
Type::Integer(IntegerType::I16) => {
|
||||||
Type::I128 => Literal::I128(iteration_count.to_string(), Default::default()),
|
Literal::Integer(IntegerType::I16, iteration_count.to_string(), Default::default())
|
||||||
Type::U8 => Literal::U8(iteration_count.to_string(), Default::default()),
|
}
|
||||||
Type::U16 => Literal::U16(iteration_count.to_string(), Default::default()),
|
Type::Integer(IntegerType::I32) => {
|
||||||
Type::U32 => Literal::U32(iteration_count.to_string(), Default::default()),
|
Literal::Integer(IntegerType::I32, iteration_count.to_string(), Default::default())
|
||||||
Type::U64 => Literal::U64(iteration_count.to_string(), Default::default()),
|
}
|
||||||
Type::U128 => Literal::U128(iteration_count.to_string(), Default::default()),
|
Type::Integer(IntegerType::I64) => {
|
||||||
|
Literal::Integer(IntegerType::I64, iteration_count.to_string(), Default::default())
|
||||||
|
}
|
||||||
|
Type::Integer(IntegerType::I128) => {
|
||||||
|
Literal::Integer(IntegerType::I128, iteration_count.to_string(), Default::default())
|
||||||
|
}
|
||||||
|
Type::Integer(IntegerType::U8) => {
|
||||||
|
Literal::Integer(IntegerType::U8, iteration_count.to_string(), Default::default())
|
||||||
|
}
|
||||||
|
Type::Integer(IntegerType::U16) => {
|
||||||
|
Literal::Integer(IntegerType::U16, iteration_count.to_string(), Default::default())
|
||||||
|
}
|
||||||
|
Type::Integer(IntegerType::U32) => {
|
||||||
|
Literal::Integer(IntegerType::U32, iteration_count.to_string(), Default::default())
|
||||||
|
}
|
||||||
|
Type::Integer(IntegerType::U64) => {
|
||||||
|
Literal::Integer(IntegerType::U64, iteration_count.to_string(), Default::default())
|
||||||
|
}
|
||||||
|
Type::Integer(IntegerType::U128) => {
|
||||||
|
Literal::Integer(IntegerType::U128, iteration_count.to_string(), Default::default())
|
||||||
|
}
|
||||||
_ => unreachable!(
|
_ => unreachable!(
|
||||||
"The iteration variable must be an integer type. This should be enforced by type checking."
|
"The iteration variable must be an integer type. This should be enforced by type checking."
|
||||||
),
|
),
|
||||||
|
@ -15,7 +15,10 @@
|
|||||||
// 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 leo_ast::*;
|
use leo_ast::*;
|
||||||
|
use leo_errors::emitter::Handler;
|
||||||
use leo_errors::TypeCheckerError;
|
use leo_errors::TypeCheckerError;
|
||||||
|
use leo_span::Span;
|
||||||
|
use std::str::FromStr;
|
||||||
|
|
||||||
use crate::TypeChecker;
|
use crate::TypeChecker;
|
||||||
|
|
||||||
@ -146,7 +149,7 @@ impl<'a> ExpressionVisitor<'a> for TypeChecker<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
self.emit_err(TypeCheckerError::invalid_circuit(&access.inner, access.inner.span()));
|
self.emit_err(TypeCheckerError::undefined_type(&access.inner, access.inner.span()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Some(type_) => {
|
Some(type_) => {
|
||||||
@ -165,161 +168,6 @@ impl<'a> ExpressionVisitor<'a> for TypeChecker<'a> {
|
|||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_circuit_init(&mut self, input: &'a CircuitExpression, additional: &Self::AdditionalInput) -> Self::Output {
|
|
||||||
let circ = self.symbol_table.borrow().lookup_circuit(input.name.name).cloned();
|
|
||||||
if let Some(circ) = circ {
|
|
||||||
// Check circuit type name.
|
|
||||||
let ret = self.check_expected_circuit(circ.identifier, additional, input.name.span());
|
|
||||||
|
|
||||||
// Check number of circuit members.
|
|
||||||
if circ.members.len() != input.members.len() {
|
|
||||||
self.emit_err(TypeCheckerError::incorrect_num_circuit_members(
|
|
||||||
circ.members.len(),
|
|
||||||
input.members.len(),
|
|
||||||
input.span(),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check circuit member types.
|
|
||||||
circ.members
|
|
||||||
.iter()
|
|
||||||
.for_each(|CircuitMember::CircuitVariable(name, ty)| {
|
|
||||||
// Lookup circuit variable name.
|
|
||||||
if let Some(actual) = input.members.iter().find(|member| member.identifier.name == name.name) {
|
|
||||||
if let Some(expr) = &actual.expression {
|
|
||||||
self.visit_expression(expr, &Some(ty.clone()));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
self.emit_err(TypeCheckerError::missing_circuit_member(
|
|
||||||
circ.identifier,
|
|
||||||
name,
|
|
||||||
input.span(),
|
|
||||||
));
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
Some(ret)
|
|
||||||
} else {
|
|
||||||
self.emit_err(TypeCheckerError::unknown_sym(
|
|
||||||
"circuit",
|
|
||||||
&input.name.name,
|
|
||||||
input.name.span(),
|
|
||||||
));
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn visit_identifier(&mut self, var: &'a Identifier, expected: &Self::AdditionalInput) -> Self::Output {
|
|
||||||
if let Some(circuit) = self.symbol_table.borrow().lookup_circuit(var.name) {
|
|
||||||
Some(self.assert_and_return_type(Type::Identifier(circuit.identifier), expected, var.span))
|
|
||||||
} else if let Some(var) = self.symbol_table.borrow().lookup_variable(var.name) {
|
|
||||||
Some(self.assert_and_return_type(var.type_.clone(), expected, var.span))
|
|
||||||
} else {
|
|
||||||
self.emit_err(TypeCheckerError::unknown_sym("variable", var.name, var.span()));
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn visit_literal(&mut self, input: &'a Literal, expected: &Self::AdditionalInput) -> Self::Output {
|
|
||||||
// Closure to produce a negated integer as a string.
|
|
||||||
let negate_int = |str_content: &String| {
|
|
||||||
if self.negate {
|
|
||||||
format!("-{str_content}")
|
|
||||||
} else {
|
|
||||||
str_content.clone()
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
Some(match input {
|
|
||||||
Literal::Address(_, _) => self.assert_and_return_type(Type::Address, expected, input.span()),
|
|
||||||
Literal::Boolean(_, _) => self.assert_and_return_type(Type::Boolean, expected, input.span()),
|
|
||||||
Literal::Field(_, _) => self.assert_and_return_type(Type::Field, expected, input.span()),
|
|
||||||
Literal::I8(str_content, _) => {
|
|
||||||
let int = negate_int(str_content);
|
|
||||||
|
|
||||||
if int.parse::<i8>().is_err() {
|
|
||||||
self.handler
|
|
||||||
.emit_err(TypeCheckerError::invalid_int_value(int, "i8", input.span()));
|
|
||||||
}
|
|
||||||
self.assert_and_return_type(Type::I8, expected, input.span())
|
|
||||||
}
|
|
||||||
Literal::I16(str_content, _) => {
|
|
||||||
let int = negate_int(str_content);
|
|
||||||
|
|
||||||
if int.parse::<i16>().is_err() {
|
|
||||||
self.handler
|
|
||||||
.emit_err(TypeCheckerError::invalid_int_value(int, "i16", input.span()));
|
|
||||||
}
|
|
||||||
self.assert_and_return_type(Type::I16, expected, input.span())
|
|
||||||
}
|
|
||||||
Literal::I32(str_content, _) => {
|
|
||||||
let int = negate_int(str_content);
|
|
||||||
|
|
||||||
if int.parse::<i32>().is_err() {
|
|
||||||
self.handler
|
|
||||||
.emit_err(TypeCheckerError::invalid_int_value(int, "i32", input.span()));
|
|
||||||
}
|
|
||||||
self.assert_and_return_type(Type::I32, expected, input.span())
|
|
||||||
}
|
|
||||||
Literal::I64(str_content, _) => {
|
|
||||||
let int = negate_int(str_content);
|
|
||||||
|
|
||||||
if int.parse::<i64>().is_err() {
|
|
||||||
self.handler
|
|
||||||
.emit_err(TypeCheckerError::invalid_int_value(int, "i64", input.span()));
|
|
||||||
}
|
|
||||||
self.assert_and_return_type(Type::I64, expected, input.span())
|
|
||||||
}
|
|
||||||
Literal::I128(str_content, _) => {
|
|
||||||
let int = negate_int(str_content);
|
|
||||||
|
|
||||||
if int.parse::<i128>().is_err() {
|
|
||||||
self.handler
|
|
||||||
.emit_err(TypeCheckerError::invalid_int_value(int, "i128", input.span()));
|
|
||||||
}
|
|
||||||
self.assert_and_return_type(Type::I128, expected, input.span())
|
|
||||||
}
|
|
||||||
Literal::U8(str_content, _) => {
|
|
||||||
if str_content.parse::<u8>().is_err() {
|
|
||||||
self.handler
|
|
||||||
.emit_err(TypeCheckerError::invalid_int_value(str_content, "u8", input.span()));
|
|
||||||
}
|
|
||||||
self.assert_and_return_type(Type::U8, expected, input.span())
|
|
||||||
}
|
|
||||||
Literal::U16(str_content, _) => {
|
|
||||||
if str_content.parse::<u16>().is_err() {
|
|
||||||
self.handler
|
|
||||||
.emit_err(TypeCheckerError::invalid_int_value(str_content, "u16", input.span()));
|
|
||||||
}
|
|
||||||
self.assert_and_return_type(Type::U16, expected, input.span())
|
|
||||||
}
|
|
||||||
Literal::U32(str_content, _) => {
|
|
||||||
if str_content.parse::<u32>().is_err() {
|
|
||||||
self.handler
|
|
||||||
.emit_err(TypeCheckerError::invalid_int_value(str_content, "u32", input.span()));
|
|
||||||
}
|
|
||||||
self.assert_and_return_type(Type::U32, expected, input.span())
|
|
||||||
}
|
|
||||||
Literal::U64(str_content, _) => {
|
|
||||||
if str_content.parse::<u64>().is_err() {
|
|
||||||
self.handler
|
|
||||||
.emit_err(TypeCheckerError::invalid_int_value(str_content, "u64", input.span()));
|
|
||||||
}
|
|
||||||
self.assert_and_return_type(Type::U64, expected, input.span())
|
|
||||||
}
|
|
||||||
Literal::U128(str_content, _) => {
|
|
||||||
if str_content.parse::<u128>().is_err() {
|
|
||||||
self.handler
|
|
||||||
.emit_err(TypeCheckerError::invalid_int_value(str_content, "u128", input.span()));
|
|
||||||
}
|
|
||||||
self.assert_and_return_type(Type::U128, expected, input.span())
|
|
||||||
}
|
|
||||||
Literal::Group(_) => self.assert_and_return_type(Type::Group, expected, input.span()),
|
|
||||||
Literal::Scalar(_, _) => self.assert_and_return_type(Type::Scalar, expected, input.span()),
|
|
||||||
Literal::String(_, _) => self.assert_and_return_type(Type::String, expected, input.span()),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
fn visit_binary(&mut self, input: &'a BinaryExpression, destination: &Self::AdditionalInput) -> Self::Output {
|
fn visit_binary(&mut self, input: &'a BinaryExpression, destination: &Self::AdditionalInput) -> Self::Output {
|
||||||
match input.op {
|
match input.op {
|
||||||
BinaryOperation::And | BinaryOperation::Or | BinaryOperation::Nand | BinaryOperation::Nor => {
|
BinaryOperation::And | BinaryOperation::Or | BinaryOperation::Nand | BinaryOperation::Nor => {
|
||||||
@ -566,6 +414,120 @@ impl<'a> ExpressionVisitor<'a> for TypeChecker<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn visit_circuit_init(&mut self, input: &'a CircuitExpression, additional: &Self::AdditionalInput) -> Self::Output {
|
||||||
|
let circ = self.symbol_table.borrow().lookup_circuit(input.name.name).cloned();
|
||||||
|
if let Some(circ) = circ {
|
||||||
|
// Check circuit type name.
|
||||||
|
let ret = self.check_expected_circuit(circ.identifier, additional, input.name.span());
|
||||||
|
|
||||||
|
// Check number of circuit members.
|
||||||
|
if circ.members.len() != input.members.len() {
|
||||||
|
self.emit_err(TypeCheckerError::incorrect_num_circuit_members(
|
||||||
|
circ.members.len(),
|
||||||
|
input.members.len(),
|
||||||
|
input.span(),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check circuit member types.
|
||||||
|
circ.members
|
||||||
|
.iter()
|
||||||
|
.for_each(|CircuitMember::CircuitVariable(name, ty)| {
|
||||||
|
// Lookup circuit variable name.
|
||||||
|
if let Some(actual) = input.members.iter().find(|member| member.identifier.name == name.name) {
|
||||||
|
if let Some(expr) = &actual.expression {
|
||||||
|
self.visit_expression(expr, &Some(ty.clone()));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
self.emit_err(TypeCheckerError::missing_circuit_member(
|
||||||
|
circ.identifier,
|
||||||
|
name,
|
||||||
|
input.span(),
|
||||||
|
));
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
Some(ret)
|
||||||
|
} else {
|
||||||
|
self.emit_err(TypeCheckerError::unknown_sym(
|
||||||
|
"circuit",
|
||||||
|
&input.name.name,
|
||||||
|
input.name.span(),
|
||||||
|
));
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn visit_identifier(&mut self, var: &'a Identifier, expected: &Self::AdditionalInput) -> Self::Output {
|
||||||
|
if let Some(circuit) = self.symbol_table.borrow().lookup_circuit(var.name) {
|
||||||
|
Some(self.assert_and_return_type(Type::Identifier(circuit.identifier), expected, var.span))
|
||||||
|
} else if let Some(var) = self.symbol_table.borrow().lookup_variable(var.name) {
|
||||||
|
Some(self.assert_and_return_type(var.type_.clone(), expected, var.span))
|
||||||
|
} else {
|
||||||
|
self.emit_err(TypeCheckerError::unknown_sym("variable", var.name, var.span()));
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn visit_literal(&mut self, input: &'a Literal, expected: &Self::AdditionalInput) -> Self::Output {
|
||||||
|
fn parse_integer_literal<I: FromStr>(handler: &Handler, string: &String, span: Span, type_string: &str) {
|
||||||
|
if string.parse::<I>().is_err() {
|
||||||
|
handler.emit_err(TypeCheckerError::invalid_int_value(string, type_string, span));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Some(match input {
|
||||||
|
Literal::Address(_, _) => self.assert_and_return_type(Type::Address, expected, input.span()),
|
||||||
|
Literal::Boolean(_, _) => self.assert_and_return_type(Type::Boolean, expected, input.span()),
|
||||||
|
Literal::Field(_, _) => self.assert_and_return_type(Type::Field, expected, input.span()),
|
||||||
|
Literal::Integer(integer_type, string, _) => match integer_type {
|
||||||
|
IntegerType::U8 => {
|
||||||
|
parse_integer_literal::<u8>(self.handler, string, input.span(), "u8");
|
||||||
|
self.assert_and_return_type(Type::Integer(IntegerType::U8), expected, input.span())
|
||||||
|
}
|
||||||
|
IntegerType::U16 => {
|
||||||
|
parse_integer_literal::<u16>(self.handler, string, input.span(), "u16");
|
||||||
|
self.assert_and_return_type(Type::Integer(IntegerType::U16), expected, input.span())
|
||||||
|
}
|
||||||
|
IntegerType::U32 => {
|
||||||
|
parse_integer_literal::<u32>(self.handler, string, input.span(), "u32");
|
||||||
|
self.assert_and_return_type(Type::Integer(IntegerType::U32), expected, input.span())
|
||||||
|
}
|
||||||
|
IntegerType::U64 => {
|
||||||
|
parse_integer_literal::<u64>(self.handler, string, input.span(), "u64");
|
||||||
|
self.assert_and_return_type(Type::Integer(IntegerType::U64), expected, input.span())
|
||||||
|
}
|
||||||
|
IntegerType::U128 => {
|
||||||
|
parse_integer_literal::<u128>(self.handler, string, input.span(), "u128");
|
||||||
|
self.assert_and_return_type(Type::Integer(IntegerType::U128), expected, input.span())
|
||||||
|
}
|
||||||
|
IntegerType::I8 => {
|
||||||
|
parse_integer_literal::<i8>(self.handler, string, input.span(), "i8");
|
||||||
|
self.assert_and_return_type(Type::Integer(IntegerType::I8), expected, input.span())
|
||||||
|
}
|
||||||
|
IntegerType::I16 => {
|
||||||
|
parse_integer_literal::<i16>(self.handler, string, input.span(), "i16");
|
||||||
|
self.assert_and_return_type(Type::Integer(IntegerType::I16), expected, input.span())
|
||||||
|
}
|
||||||
|
IntegerType::I32 => {
|
||||||
|
parse_integer_literal::<i32>(self.handler, string, input.span(), "i32");
|
||||||
|
self.assert_and_return_type(Type::Integer(IntegerType::I32), expected, input.span())
|
||||||
|
}
|
||||||
|
IntegerType::I64 => {
|
||||||
|
parse_integer_literal::<i64>(self.handler, string, input.span(), "i64");
|
||||||
|
self.assert_and_return_type(Type::Integer(IntegerType::I64), expected, input.span())
|
||||||
|
}
|
||||||
|
IntegerType::I128 => {
|
||||||
|
parse_integer_literal::<i128>(self.handler, string, input.span(), "i128");
|
||||||
|
self.assert_and_return_type(Type::Integer(IntegerType::I128), expected, input.span())
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Literal::Group(_) => self.assert_and_return_type(Type::Group, expected, input.span()),
|
||||||
|
Literal::Scalar(_, _) => self.assert_and_return_type(Type::Scalar, expected, input.span()),
|
||||||
|
Literal::String(_, _) => self.assert_and_return_type(Type::String, expected, input.span()),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
fn visit_ternary(&mut self, input: &'a TernaryExpression, expected: &Self::AdditionalInput) -> Self::Output {
|
fn visit_ternary(&mut self, input: &'a TernaryExpression, expected: &Self::AdditionalInput) -> Self::Output {
|
||||||
self.visit_expression(&input.condition, &Some(Type::Boolean));
|
self.visit_expression(&input.condition, &Some(Type::Boolean));
|
||||||
|
|
||||||
@ -626,11 +588,7 @@ impl<'a> ExpressionVisitor<'a> for TypeChecker<'a> {
|
|||||||
self.visit_expression(&input.receiver, destination)
|
self.visit_expression(&input.receiver, destination)
|
||||||
}
|
}
|
||||||
UnaryOperation::Negate => {
|
UnaryOperation::Negate => {
|
||||||
let prior_negate_state = self.negate;
|
|
||||||
self.negate = true;
|
|
||||||
|
|
||||||
let type_ = self.visit_expression(&input.receiver, destination);
|
let type_ = self.visit_expression(&input.receiver, destination);
|
||||||
self.negate = prior_negate_state;
|
|
||||||
|
|
||||||
// Only field, group, or signed integer types.
|
// Only field, group, or signed integer types.
|
||||||
self.assert_field_group_signed_int_type(&type_, input.receiver.span());
|
self.assert_field_group_signed_int_type(&type_, input.receiver.span());
|
||||||
|
@ -45,6 +45,8 @@ impl<'a> ProgramVisitor<'a> for TypeChecker<'a> {
|
|||||||
self.has_return = false;
|
self.has_return = false;
|
||||||
self.parent = Some(input.name());
|
self.parent = Some(input.name());
|
||||||
input.input.iter().for_each(|input_var| {
|
input.input.iter().for_each(|input_var| {
|
||||||
|
// Check that the type of input parameter is valid.
|
||||||
|
self.assert_type_is_valid(input_var.span, &input_var.type_);
|
||||||
self.assert_not_tuple(input_var.span, &input_var.type_);
|
self.assert_not_tuple(input_var.span, &input_var.type_);
|
||||||
|
|
||||||
// If the function is not a program function, then check that the parameters do not have an associated mode.
|
// If the function is not a program function, then check that the parameters do not have an associated mode.
|
||||||
@ -70,6 +72,10 @@ impl<'a> ProgramVisitor<'a> for TypeChecker<'a> {
|
|||||||
|
|
||||||
if !self.has_return {
|
if !self.has_return {
|
||||||
self.emit_err(TypeCheckerError::function_has_no_return(input.name(), input.span()));
|
self.emit_err(TypeCheckerError::function_has_no_return(input.name(), input.span()));
|
||||||
|
} else {
|
||||||
|
// Check that the return type is valid.
|
||||||
|
// TODO: Span should be just for the return type.
|
||||||
|
self.assert_type_is_valid(input.span, &input.output);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure there are no nested tuples in the return type.
|
// Ensure there are no nested tuples in the return type.
|
||||||
@ -90,7 +96,16 @@ impl<'a> ProgramVisitor<'a> for TypeChecker<'a> {
|
|||||||
fn visit_circuit(&mut self, input: &'a Circuit) {
|
fn visit_circuit(&mut self, input: &'a Circuit) {
|
||||||
// Check for conflicting circuit/record member names.
|
// Check for conflicting circuit/record member names.
|
||||||
let mut used = HashSet::new();
|
let mut used = HashSet::new();
|
||||||
if !input.members.iter().all(|member| used.insert(member.name())) {
|
if !input
|
||||||
|
.members
|
||||||
|
.iter()
|
||||||
|
.all(|CircuitMember::CircuitVariable(ident, type_)| {
|
||||||
|
// TODO: Better spans.
|
||||||
|
// Check that the member types are valid.
|
||||||
|
self.assert_type_is_valid(input.span, type_);
|
||||||
|
used.insert(ident.name)
|
||||||
|
})
|
||||||
|
{
|
||||||
self.emit_err(if input.is_record {
|
self.emit_err(if input.is_record {
|
||||||
TypeCheckerError::duplicate_record_variable(input.name(), input.span())
|
TypeCheckerError::duplicate_record_variable(input.name(), input.span())
|
||||||
} else {
|
} else {
|
||||||
@ -122,7 +137,7 @@ impl<'a> ProgramVisitor<'a> for TypeChecker<'a> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
check_has_field(sym::owner, Type::Address);
|
check_has_field(sym::owner, Type::Address);
|
||||||
check_has_field(sym::gates, Type::U64);
|
check_has_field(sym::gates, Type::Integer(IntegerType::U64));
|
||||||
}
|
}
|
||||||
|
|
||||||
for CircuitMember::CircuitVariable(v, type_) in input.members.iter() {
|
for CircuitMember::CircuitVariable(v, type_) in input.members.iter() {
|
||||||
|
@ -61,6 +61,9 @@ impl<'a> StatementVisitor<'a> for TypeChecker<'a> {
|
|||||||
VariableType::Mut
|
VariableType::Mut
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Check that the type of the definition is valid.
|
||||||
|
self.assert_type_is_valid(input.span, &input.type_);
|
||||||
|
|
||||||
self.visit_expression(&input.value, &Some(input.type_.clone()));
|
self.visit_expression(&input.value, &Some(input.type_.clone()));
|
||||||
|
|
||||||
if let Err(err) = self.symbol_table.borrow_mut().insert_variable(
|
if let Err(err) = self.symbol_table.borrow_mut().insert_variable(
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
use crate::SymbolTable;
|
use crate::SymbolTable;
|
||||||
|
|
||||||
use leo_ast::{Identifier, Node, Type};
|
use leo_ast::{Identifier, IntegerType, Node, Type};
|
||||||
use leo_core::*;
|
use leo_core::*;
|
||||||
use leo_errors::{emitter::Handler, TypeCheckerError};
|
use leo_errors::{emitter::Handler, TypeCheckerError};
|
||||||
use leo_span::{Span, Symbol};
|
use leo_span::{Span, Symbol};
|
||||||
@ -29,7 +29,6 @@ pub struct TypeChecker<'a> {
|
|||||||
pub(crate) handler: &'a Handler,
|
pub(crate) handler: &'a Handler,
|
||||||
pub(crate) parent: Option<Symbol>,
|
pub(crate) parent: Option<Symbol>,
|
||||||
pub(crate) has_return: bool,
|
pub(crate) has_return: bool,
|
||||||
pub(crate) negate: bool,
|
|
||||||
/// Are we traversing a program function?
|
/// Are we traversing a program function?
|
||||||
/// A "program function" is a function that can be invoked by a user or another program.
|
/// A "program function" is a function that can be invoked by a user or another program.
|
||||||
pub(crate) is_program_function: bool,
|
pub(crate) is_program_function: bool,
|
||||||
@ -44,23 +43,39 @@ const GROUP_TYPE: Type = Type::Group;
|
|||||||
const SCALAR_TYPE: Type = Type::Scalar;
|
const SCALAR_TYPE: Type = Type::Scalar;
|
||||||
|
|
||||||
const INT_TYPES: [Type; 10] = [
|
const INT_TYPES: [Type; 10] = [
|
||||||
Type::I8,
|
Type::Integer(IntegerType::I8),
|
||||||
Type::I16,
|
Type::Integer(IntegerType::I16),
|
||||||
Type::I32,
|
Type::Integer(IntegerType::I32),
|
||||||
Type::I64,
|
Type::Integer(IntegerType::I64),
|
||||||
Type::I128,
|
Type::Integer(IntegerType::I128),
|
||||||
Type::U8,
|
Type::Integer(IntegerType::U8),
|
||||||
Type::U16,
|
Type::Integer(IntegerType::U16),
|
||||||
Type::U32,
|
Type::Integer(IntegerType::U32),
|
||||||
Type::U64,
|
Type::Integer(IntegerType::U64),
|
||||||
Type::U128,
|
Type::Integer(IntegerType::U128),
|
||||||
];
|
];
|
||||||
|
|
||||||
const SIGNED_INT_TYPES: [Type; 5] = [Type::I8, Type::I16, Type::I32, Type::I64, Type::I128];
|
const SIGNED_INT_TYPES: [Type; 5] = [
|
||||||
|
Type::Integer(IntegerType::I8),
|
||||||
|
Type::Integer(IntegerType::I16),
|
||||||
|
Type::Integer(IntegerType::I32),
|
||||||
|
Type::Integer(IntegerType::I64),
|
||||||
|
Type::Integer(IntegerType::I128),
|
||||||
|
];
|
||||||
|
|
||||||
const UNSIGNED_INT_TYPES: [Type; 5] = [Type::U8, Type::U16, Type::U32, Type::U64, Type::U128];
|
const UNSIGNED_INT_TYPES: [Type; 5] = [
|
||||||
|
Type::Integer(IntegerType::U8),
|
||||||
|
Type::Integer(IntegerType::U16),
|
||||||
|
Type::Integer(IntegerType::U32),
|
||||||
|
Type::Integer(IntegerType::U64),
|
||||||
|
Type::Integer(IntegerType::U128),
|
||||||
|
];
|
||||||
|
|
||||||
const MAGNITUDE_TYPES: [Type; 3] = [Type::U8, Type::U16, Type::U32];
|
const MAGNITUDE_TYPES: [Type; 3] = [
|
||||||
|
Type::Integer(IntegerType::U8),
|
||||||
|
Type::Integer(IntegerType::U16),
|
||||||
|
Type::Integer(IntegerType::U32),
|
||||||
|
];
|
||||||
|
|
||||||
impl<'a> TypeChecker<'a> {
|
impl<'a> TypeChecker<'a> {
|
||||||
/// Returns a new type checker given a symbol table and error handler.
|
/// Returns a new type checker given a symbol table and error handler.
|
||||||
@ -71,7 +86,6 @@ impl<'a> TypeChecker<'a> {
|
|||||||
handler,
|
handler,
|
||||||
parent: None,
|
parent: None,
|
||||||
has_return: false,
|
has_return: false,
|
||||||
negate: false,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -342,6 +356,23 @@ impl<'a> TypeChecker<'a> {
|
|||||||
_ => {} // Do nothing.
|
_ => {} // Do nothing.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Emits an error if the type is not valid.
|
||||||
|
pub(crate) fn assert_type_is_valid(&self, span: Span, type_: &Type) {
|
||||||
|
match type_ {
|
||||||
|
// Check that the named composite type has been defined.
|
||||||
|
Type::Identifier(identifier) if self.symbol_table.borrow().lookup_circuit(identifier.name).is_none() => {
|
||||||
|
self.emit_err(TypeCheckerError::undefined_type(identifier.name, span));
|
||||||
|
}
|
||||||
|
// Check that the constituent types are valid.
|
||||||
|
Type::Tuple(tuple_type) => {
|
||||||
|
for type_ in tuple_type.iter() {
|
||||||
|
self.assert_type_is_valid(span, type_)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => {} // Do nothing.
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn types_to_string(types: &[Type]) -> String {
|
fn types_to_string(types: &[Type]) -> String {
|
||||||
|
@ -193,10 +193,10 @@ create_messages!(
|
|||||||
|
|
||||||
/// Attempted to access an invalid circuit.
|
/// Attempted to access an invalid circuit.
|
||||||
@formatted
|
@formatted
|
||||||
invalid_circuit {
|
undefined_type {
|
||||||
args: (circuit: impl Display),
|
args: (type_: impl Display),
|
||||||
msg: format!(
|
msg: format!(
|
||||||
"Circuit {circuit} is not found in the current scope."
|
"The type `{type_}` is not found in the current scope."
|
||||||
),
|
),
|
||||||
help: None,
|
help: None,
|
||||||
}
|
}
|
||||||
|
2
examples/twoadicity/.gitignore
vendored
Normal file
2
examples/twoadicity/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
outputs/
|
||||||
|
build/
|
8
examples/twoadicity/README.md
Normal file
8
examples/twoadicity/README.md
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# src/twoadicity.leo
|
||||||
|
|
||||||
|
## Build Guide
|
||||||
|
|
||||||
|
To compile and run this Leo program, run:
|
||||||
|
```bash
|
||||||
|
leo run
|
||||||
|
```
|
11
examples/twoadicity/inputs/twoadicity.in
Normal file
11
examples/twoadicity/inputs/twoadicity.in
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
// The program input for twoadicity/src/main.leo
|
||||||
|
[main]
|
||||||
|
// Here is a made-up example.
|
||||||
|
// public a: field = 391995973843653359517682711560178397928211734490775552field;
|
||||||
|
// (comes from: 2field.pow(41) * 178259130663561045147472537592047227885001field)
|
||||||
|
|
||||||
|
// This example is (maxfield - 1).
|
||||||
|
// The output for this can be seen in the Pratt certificate
|
||||||
|
// for bls12-377-scalar-field-prime
|
||||||
|
// as the number of factors of 2 in (bls12-377-scalar-field-prime - 1).
|
||||||
|
public a: field = 8444461749428370424248824938781546531375899335154063827935233455917409239040field;
|
10
examples/twoadicity/program.json
Normal file
10
examples/twoadicity/program.json
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"program": "twoadicity.aleo",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"description": "",
|
||||||
|
"development": {
|
||||||
|
"private_key": "APrivateKey1zkp3JKK9YGWZYbPUVShFurexLMqRp1JHuvub9fnZwNW7XsW",
|
||||||
|
"address": "aleo1cagy225kufzj3fs2jvf8mk84dvx7umq53u4rana2ukp5d68kjy8s0t24sh"
|
||||||
|
},
|
||||||
|
"license": "MIT"
|
||||||
|
}
|
26
examples/twoadicity/src/main.leo
Normal file
26
examples/twoadicity/src/main.leo
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
// The 'twoadicity' main function.
|
||||||
|
@program
|
||||||
|
function main(public n: field) -> u8 {
|
||||||
|
let remaining_n: field = n;
|
||||||
|
let powers_of_two: u8 = 0u8;
|
||||||
|
// Since field ints are 253 bits or fewer,
|
||||||
|
// any number in the field will have at most 252 powers of two in its prime factoring.
|
||||||
|
for i:u8 in 0u8..252u8 {
|
||||||
|
if is_even_and_nonzero(remaining_n) {
|
||||||
|
remaining_n = remaining_n / 2field;
|
||||||
|
powers_of_two = powers_of_two + 1u8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return powers_of_two;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* We define the is_even predicate on fields as follows.
|
||||||
|
If n is even and nonzero, clearly n/2 < n.
|
||||||
|
If n is odd, n-p is a field-equivalent negative number that is even,
|
||||||
|
and (n-p)/2 is a field-equivalent negative number closer to 0, greater than n-p.
|
||||||
|
If we add p to both of these negative numbers, we have
|
||||||
|
n/2 = (n-p)/2 + p = (n+p)/2 is greater than n and still less than p.
|
||||||
|
*/
|
||||||
|
function is_even_and_nonzero (n: field) -> bool {
|
||||||
|
return n / 2field < n;
|
||||||
|
}
|
14
tests/compiler/circuits/unknown_member_type_fail.leo
Normal file
14
tests/compiler/circuits/unknown_member_type_fail.leo
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
/*
|
||||||
|
namespace: Compile
|
||||||
|
expectation: Fail
|
||||||
|
*/
|
||||||
|
|
||||||
|
circuit Foo {
|
||||||
|
a: u8,
|
||||||
|
bar: Bar,
|
||||||
|
}
|
||||||
|
|
||||||
|
@program
|
||||||
|
function main(a: u8) -> u8 {
|
||||||
|
return a + 1u8;
|
||||||
|
}
|
14
tests/compiler/function/unknown_parameter_type_fail.leo
Normal file
14
tests/compiler/function/unknown_parameter_type_fail.leo
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
/*
|
||||||
|
namespace: Compile
|
||||||
|
expectation: Fail
|
||||||
|
*/
|
||||||
|
|
||||||
|
@program
|
||||||
|
function main(a: u8, foo: Foo) -> u8 {
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
@program
|
||||||
|
function returns_foo(a: u8) -> Foo {
|
||||||
|
return a;
|
||||||
|
}
|
@ -1,9 +1,13 @@
|
|||||||
/*
|
/*
|
||||||
namespace: Compile
|
namespace: Compile
|
||||||
expectation: Fail
|
expectation: Pass
|
||||||
|
input_file: ../inputs/dummy.in
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function main() -> i128 {
|
// TODO: This test passes, but constant propogation should detect an overflow.
|
||||||
|
|
||||||
|
@program
|
||||||
|
function main(y: bool) -> i128 {
|
||||||
let a: i128 = -170141183460469231731687303715884105727i128;
|
let a: i128 = -170141183460469231731687303715884105727i128;
|
||||||
|
|
||||||
return a - 2i128; // This line attempts to return --170141183460469231731687303715884105729i128 however, the smallest i128 value is -170141183460469231731687303715884105728i128.
|
return a - 2i128; // This line attempts to return --170141183460469231731687303715884105729i128 however, the smallest i128 value is -170141183460469231731687303715884105728i128.
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
/*
|
/*
|
||||||
namespace: Compile
|
namespace: Compile
|
||||||
expectation: Fail
|
expectation: Pass
|
||||||
input_file: ../inputs/dummy.in
|
input_file: ../inputs/dummy.in
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function main() -> i128 {
|
// TODO: This test passes, but constant propogation should detect an overflow.
|
||||||
let a: i128 = -170141183460469231731687303715884105727i128;
|
|
||||||
let b: i128 = a - 1i128;
|
|
||||||
|
|
||||||
return -b; // This line attempts to return 170141183460469231731687303715884105728i128 however, the largest i128 value is 170141183460469231731687303715884105727i128.
|
@program
|
||||||
|
function main(y: bool) -> i128 {
|
||||||
|
let a: i128 = -170141183460469231731687303715884105728i128;
|
||||||
|
|
||||||
|
return -a; // This line attempts to return 170141183460469231731687303715884105728i128 however, the largest i128 value is 170141183460469231731687303715884105727i128.
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
namespace: Compile
|
namespace: Compile
|
||||||
expectation: Fail
|
expectation: Fail
|
||||||
|
input_file: ../inputs/dummy.in
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function main() {
|
@program
|
||||||
|
function main(y: bool) -> i16 {
|
||||||
const a: i16 = 32768i16;
|
const a: i16 = 32768i16;
|
||||||
|
return a;
|
||||||
}
|
}
|
@ -1,9 +1,13 @@
|
|||||||
/*
|
/*
|
||||||
namespace: Compile
|
namespace: Compile
|
||||||
expectation: Fail
|
expectation: Pass
|
||||||
|
input_file: ../inputs/dummy.in
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function main() -> i16 {
|
// TODO: This test passes, but constant propogation should detect an overflow.
|
||||||
|
|
||||||
|
@program
|
||||||
|
function main(y: bool) -> i16 {
|
||||||
let a: i16 = -32767i16;
|
let a: i16 = -32767i16;
|
||||||
|
|
||||||
return a - 2i16; // This line attempts to return -32769i16 however, the smallest i16 value is -32768i16.
|
return a - 2i16; // This line attempts to return -32769i16 however, the smallest i16 value is -32768i16.
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
/*
|
/*
|
||||||
namespace: Compile
|
namespace: Compile
|
||||||
expectation: Fail
|
expectation: Pass
|
||||||
input_file: ../inputs/dummy.in
|
input_file: ../inputs/dummy.in
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function main() -> i16 {
|
// TODO: This test passes, but constant propogation should detect an overflow.
|
||||||
let a: i16 = -32767i16;
|
|
||||||
let b: i16 = a - 1i16;
|
|
||||||
|
|
||||||
return -b; // This line attempts to return 32768i16 however, the largest i16 value is 32767i16.
|
@program
|
||||||
|
function main(y: bool) -> i16 {
|
||||||
|
let a: i16 = -32768i16;
|
||||||
|
|
||||||
|
return -a; // This line attempts to return 32768i16 however, the largest i16 value is 32767i16.
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,13 @@
|
|||||||
/*
|
/*
|
||||||
namespace: Compile
|
namespace: Compile
|
||||||
expectation: Fail
|
expectation: Pass
|
||||||
|
input_file: ../inputs/dummy.in
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function main() -> i32 {
|
// TODO: This test passes, but constant propogation should detect an overflow.
|
||||||
|
|
||||||
|
@program
|
||||||
|
function main(y: bool) -> i32 {
|
||||||
let a: i32 = -2147483647i32;
|
let a: i32 = -2147483647i32;
|
||||||
|
|
||||||
return a - 2i32; // This line attempts to return -2147483649i32 however, the smallest i32 value is -2147483648i32.
|
return a - 2i32; // This line attempts to return -2147483649i32 however, the smallest i32 value is -2147483648i32.
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
/*
|
/*
|
||||||
namespace: Compile
|
namespace: Compile
|
||||||
expectation: Fail
|
expectation: Pass
|
||||||
input_file: ../inputs/dummy.in
|
input_file: ../inputs/dummy.in
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function main() -> i32 {
|
// TODO: This test passes, but constant propogation should detect an overflow.
|
||||||
let a: i32 = -2147483647i32;
|
|
||||||
let b: i32 = a - 1i32;
|
|
||||||
|
|
||||||
return -b; // This line attempts to return 2147483648i32 however, the largest i32 value is 2147483647i32.
|
@program
|
||||||
|
function main(y: bool) -> i32 {
|
||||||
|
let a: i32 = -2147483648i32;
|
||||||
|
|
||||||
|
return -a; // This line attempts to return 2147483648i32 however, the largest i32 value is 2147483647i32.
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,13 @@
|
|||||||
/*
|
/*
|
||||||
namespace: Compile
|
namespace: Compile
|
||||||
expectation: Fail
|
expectation: Pass
|
||||||
|
input_file: ../inputs/dummy.in
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function main() -> i64 {
|
// TODO: This test passes, but constant propogation should detect an overflow.
|
||||||
|
|
||||||
|
@program
|
||||||
|
function main(y: bool) -> i64 {
|
||||||
let a: i64 = -9223372036854775807i64;
|
let a: i64 = -9223372036854775807i64;
|
||||||
|
|
||||||
return a - 2i64; // This line attempts to return -9223372036854775809i64 however, the smallest i64 value is -9223372036854775808i64.
|
return a - 2i64; // This line attempts to return -9223372036854775809i64 however, the smallest i64 value is -9223372036854775808i64.
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
/*
|
/*
|
||||||
namespace: Compile
|
namespace: Compile
|
||||||
expectation: Fail
|
expectation: Pass
|
||||||
input_file: ../inputs/dummy.in
|
input_file: ../inputs/dummy.in
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function main() -> i64 {
|
// TODO: This test passes, but constant propogation should detect an overflow.
|
||||||
let a: i64 = -9223372036854775807i64;
|
|
||||||
let b: i64 = a - 1i64;
|
|
||||||
|
|
||||||
return -b; // This line attempts to return 9223372036854775808i64 however, the largest i64 value is 9223372036854775807i64.
|
@program
|
||||||
|
function main(y: bool) -> i64 {
|
||||||
|
let a: i64 = -9223372036854775808i64;
|
||||||
|
|
||||||
|
return -a; // This line attempts to return 9223372036854775808i64 however, the largest i64 value is 9223372036854775807i64.
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,13 @@
|
|||||||
/*
|
/*
|
||||||
namespace: Compile
|
namespace: Compile
|
||||||
expectation: Fail
|
expectation: Pass
|
||||||
|
input_file: ../inputs/dummy.in
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function main() -> i8 {
|
// TODO: This test passes, but constant propogation should detect an overflow.
|
||||||
|
|
||||||
|
@program
|
||||||
|
function main(y: bool) -> i8 {
|
||||||
let a: i8 = -127i8;
|
let a: i8 = -127i8;
|
||||||
|
|
||||||
return a - 2i8; // This line attempts to return -129i8 however, the smallest i8 value is -128i8.
|
return a - 2i8; // This line attempts to return -129i8 however, the smallest i8 value is -128i8.
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
/*
|
/*
|
||||||
namespace: Compile
|
namespace: Compile
|
||||||
expectation: Fail
|
expectation: Pass
|
||||||
input_file: ../inputs/dummy.in
|
input_file: ../inputs/dummy.in
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function main() -> i8 {
|
// TODO: This test passes, but constant propogation should detect an overflow.
|
||||||
let a: i8 = -127i8;
|
|
||||||
let b: i8 = a - 1i8;
|
|
||||||
|
|
||||||
return -b; // This line attempts to return 128i8 however, the largest i8 value is 127i8.
|
@program
|
||||||
|
function main(y: bool) -> i8 {
|
||||||
|
let a: i8 = -128i8;
|
||||||
|
|
||||||
|
return -a; // This line attempts to return 128i8 however, the largest i8 value is 127i8.
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
namespace: Compile
|
namespace: Compile
|
||||||
expectation: Pass
|
expectation: Fail
|
||||||
*/
|
*/
|
||||||
|
|
||||||
circuit Amount {
|
circuit Amount {
|
||||||
|
@ -0,0 +1,11 @@
|
|||||||
|
/*
|
||||||
|
namespace: Compile
|
||||||
|
expectation: Fail
|
||||||
|
input_file: inputs/dummy.in
|
||||||
|
*/
|
||||||
|
|
||||||
|
@program
|
||||||
|
function main(k: bool) -> bool {
|
||||||
|
let b: Foo = 1u8;
|
||||||
|
return k == true;
|
||||||
|
}
|
@ -4,6 +4,6 @@ expectation: Pass
|
|||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: no input
|
- initial_input_ast: no input
|
||||||
initial_ast: 42b05cc1bf023a01dd8f8e2ae9269ebea9d33d9e33f2817700947882de3a68d6
|
initial_ast: 5c65976b4634ee0fbbad7377b00319b0c0e855c96bfbdd67239f374029116764
|
||||||
unrolled_ast: 42b05cc1bf023a01dd8f8e2ae9269ebea9d33d9e33f2817700947882de3a68d6
|
unrolled_ast: 5c65976b4634ee0fbbad7377b00319b0c0e855c96bfbdd67239f374029116764
|
||||||
ssa_ast: 8393011c629a3b5e4916744d7ad11cb04e5859608f98f134acbb8f4b489bce3c
|
ssa_ast: a906b7af20a005df6964f8eebd9699d90dd4fa004d30e13e313f9e0c68c98973
|
||||||
|
@ -4,6 +4,6 @@ expectation: Pass
|
|||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: 3ad7f9e1a4aa5edb8ab4cc1eb0d4baa189f8d388eb90565a269098cee9b06d3c
|
- initial_input_ast: 3ad7f9e1a4aa5edb8ab4cc1eb0d4baa189f8d388eb90565a269098cee9b06d3c
|
||||||
initial_ast: dbf04a84f2365baaba791dc1e55efdbbaff17159e04506a0cb4678a6ea5e6c5f
|
initial_ast: 104350e2f6dda8259ba0a4d7328471cba029bca9fa76fe0e4776900662fdce6f
|
||||||
unrolled_ast: dbf04a84f2365baaba791dc1e55efdbbaff17159e04506a0cb4678a6ea5e6c5f
|
unrolled_ast: 104350e2f6dda8259ba0a4d7328471cba029bca9fa76fe0e4776900662fdce6f
|
||||||
ssa_ast: e550a6a7bd2b01a57065db34ce68144a30ce42f2077888795ddaa79ce81291ac
|
ssa_ast: 338dc89f05324c4527d992c7f82953921e6c2f36f2c2e39a4dc6525760350b6a
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
namespace: Compile
|
||||||
|
expectation: Fail
|
||||||
|
outputs:
|
||||||
|
- "Error [ETYC0372017]: The type `Bar` is not found in the current scope.\n --> compiler-test:3:1\n |\n 3 | circuit Foo {\n 4 | a: u8,\n 5 | bar: Bar,\n 6 | }\n | ^\n"
|
@ -3,8 +3,8 @@ namespace: Compile
|
|||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: b87ab1284b31d3833752609e052fca4ab8897966498304a704da44c2e2e40646
|
- initial_input_ast: 06ca750e19583956979968f4f3fa54ae1e11219af80c88b2722ca4a169b48751
|
||||||
- initial_input_ast: 518590e47d3c1eefd56a4b20dee801e1149974bbec280afed58a8c1960b74485
|
- initial_input_ast: bdf478032fd867197166feec39cb6c567c15c78a9b0ce919730dc36ed5fdfac2
|
||||||
initial_ast: 5a8395f339c4e2c3614c478fb3bd1841f4fb711aa60c39b94c6576c2788a7354
|
initial_ast: 3bb4a339efa4ee13910a9d124bfa9accfabb3f0ee2ea26bb0fc801bf3060f665
|
||||||
unrolled_ast: 5a8395f339c4e2c3614c478fb3bd1841f4fb711aa60c39b94c6576c2788a7354
|
unrolled_ast: 3bb4a339efa4ee13910a9d124bfa9accfabb3f0ee2ea26bb0fc801bf3060f665
|
||||||
ssa_ast: e7d52a59e25fe61e60bf751a80312b40e46c1d67e1bfc442643bf0a87ef22569
|
ssa_ast: 6c85fcd78c7bd2a71868187c155bab28ef477e8b3ad9ccc449d7e7584427643e
|
||||||
|
@ -4,6 +4,6 @@ expectation: Pass
|
|||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: 987814f874125b118371952a4d882da2c78ee2c441d8fb228372ec0c8f2c5aad
|
- initial_input_ast: 987814f874125b118371952a4d882da2c78ee2c441d8fb228372ec0c8f2c5aad
|
||||||
initial_ast: ee164e9e7399f1f2de3d10d04648c33c5ed334bdd80b60e71bff4598614434f4
|
initial_ast: 5ad90e127767873141d0ffb7aece1ea35cf0596a4af53a4445de27913896bef8
|
||||||
unrolled_ast: ee164e9e7399f1f2de3d10d04648c33c5ed334bdd80b60e71bff4598614434f4
|
unrolled_ast: 5ad90e127767873141d0ffb7aece1ea35cf0596a4af53a4445de27913896bef8
|
||||||
ssa_ast: a711efa647428b754f482a984895680893bc65b3e22ef55b7feb7033bcab2edf
|
ssa_ast: 9619d9cc3de3033bddaa53a99e4b1f7156f5a71e73b2a47c40c0fe2d8141b9d4
|
||||||
|
@ -4,6 +4,6 @@ expectation: Pass
|
|||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: 7f94df9586954921fa1d2a86514669de35d102d4544fde34645d042810684363
|
- initial_input_ast: 7f94df9586954921fa1d2a86514669de35d102d4544fde34645d042810684363
|
||||||
initial_ast: 6ad2d0250ad3b4f09759024662225ef696a11dc28106c947b009073d23458800
|
initial_ast: b040faf711350fd0a4d5a0f2d24683f3b276cf1e602ed068a419c619bd98b415
|
||||||
unrolled_ast: 6ad2d0250ad3b4f09759024662225ef696a11dc28106c947b009073d23458800
|
unrolled_ast: b040faf711350fd0a4d5a0f2d24683f3b276cf1e602ed068a419c619bd98b415
|
||||||
ssa_ast: 6f67d640a8558cf6edd31bfbf722d7e3a83515b79c0aa2fd5ff64e2e39fdea6f
|
ssa_ast: 2a2f280b8c485c925fef23ceca24379dd5ff57374ebed0d503366575589bcaa8
|
||||||
|
@ -3,7 +3,7 @@ namespace: Compile
|
|||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: 43992721d507407a33d10f3afff1a090bb2ec0471e95e575f24cefc1fc7bf2ff
|
- initial_input_ast: e2bfa0e0050ddd8f84ce1a20c2ffc199a98ca3cbf8127be7981ac6a9bf6cad17
|
||||||
initial_ast: cd6f620d1b50c366e79eaa9b4a80bd9ce6060239cb2ae5c2eb241b8206e52f01
|
initial_ast: 9c2e14a8cb8c917f977bb28febb830d65f83c8cce6102d1302396d797eca312f
|
||||||
unrolled_ast: cd6f620d1b50c366e79eaa9b4a80bd9ce6060239cb2ae5c2eb241b8206e52f01
|
unrolled_ast: 9c2e14a8cb8c917f977bb28febb830d65f83c8cce6102d1302396d797eca312f
|
||||||
ssa_ast: 460516746a59780de3935221797c236a7bad2e475a8078a30a809403c67836ae
|
ssa_ast: 953e64b995f1db499d4af9196751daf05c19ff8586058f8816bbc8e59071d7dd
|
||||||
|
@ -3,7 +3,7 @@ namespace: Compile
|
|||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: 4e49ec4d638b46ab5f86cdc3a490f0a9074ed71065bfe39e4c3400fa7e7d729b
|
- initial_input_ast: fbfd0e7729a170e9ad5edbe89d81a834f80286bdac7386e976bef82006266241
|
||||||
initial_ast: af858f851dfec04c4d206755aa91b0ab701a13cbffa77a88c93a7a6a4483ebf3
|
initial_ast: 3bb94652d20591cab35478dd2d59a559f1c8f26e2561bb707c31343e9c3d482b
|
||||||
unrolled_ast: af858f851dfec04c4d206755aa91b0ab701a13cbffa77a88c93a7a6a4483ebf3
|
unrolled_ast: 3bb94652d20591cab35478dd2d59a559f1c8f26e2561bb707c31343e9c3d482b
|
||||||
ssa_ast: 9adff39c81008da0d1152fe1f8bca8d1c106e793fafbc05ba3778c351b2ea391
|
ssa_ast: ae587914b9e8979809455e4d184b29b0e069e43b4d00cfa9c1d8dc4467497c89
|
||||||
|
@ -3,7 +3,7 @@ namespace: Compile
|
|||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: e57e2971deec32a3b718fd4acc86c7d71fc2acbdba6c81f28c2a510b3fa64947
|
- initial_input_ast: 30bcdf9e3064f59cff10bde5c59834ff95d21da38a9f0db7f12dee3017ae5887
|
||||||
initial_ast: 0f356614fca7d35440b1c677d973a166009b0b2e8c09ec6445f542dd5baaddd9
|
initial_ast: 7169ffd66a51e90cfdeabe43eec375b249f37b817f2678768b491ef6e2ad931a
|
||||||
unrolled_ast: 0f356614fca7d35440b1c677d973a166009b0b2e8c09ec6445f542dd5baaddd9
|
unrolled_ast: 7169ffd66a51e90cfdeabe43eec375b249f37b817f2678768b491ef6e2ad931a
|
||||||
ssa_ast: a11cb24779cce1859966931b08208aaa9cd8db6cdceb7f7e27246678a92ff748
|
ssa_ast: 1d956eda2272fca55c831aae60ba2dac46d30a550e0091dd2ff8eddf9a811165
|
||||||
|
@ -3,7 +3,7 @@ namespace: Compile
|
|||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: a76e3cbec17567bc7e5f8377c10fd50c145ab29ef6f915dd867c398412d9715b
|
- initial_input_ast: 8c88aa92e2f75c9e87085f5f02553aa660cecd69581cbcaccd29b27fd2d075a8
|
||||||
initial_ast: d62b24b6e20445b7a669320bc023d2f8f74ae3dfeaf4cba935760e11b5b98ff1
|
initial_ast: bef7cb39477c6e74c2d5569dcbeb540af561fda971924bbc9bcf6a93e385ba30
|
||||||
unrolled_ast: d62b24b6e20445b7a669320bc023d2f8f74ae3dfeaf4cba935760e11b5b98ff1
|
unrolled_ast: bef7cb39477c6e74c2d5569dcbeb540af561fda971924bbc9bcf6a93e385ba30
|
||||||
ssa_ast: 5b29bf98344df84d0fcf41e0c10c64f1eddff792260c3f0104ef2a20834a9001
|
ssa_ast: 6ba100cc26ba1d62e606fcb3f5cc11eb0fca4714227d1a5d3dbd91bcd282e5df
|
||||||
|
@ -3,7 +3,7 @@ namespace: Compile
|
|||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: e57e2971deec32a3b718fd4acc86c7d71fc2acbdba6c81f28c2a510b3fa64947
|
- initial_input_ast: 30bcdf9e3064f59cff10bde5c59834ff95d21da38a9f0db7f12dee3017ae5887
|
||||||
initial_ast: 2bd84fb0d42145c35bd237786c3bc551047c7e07d93007adc5c660c3cc81e00b
|
initial_ast: 4e081c0897bb0b2e66078430d5e5b4cbc6f27d400be7a41be7efd59b2da12c17
|
||||||
unrolled_ast: 2bd84fb0d42145c35bd237786c3bc551047c7e07d93007adc5c660c3cc81e00b
|
unrolled_ast: 4e081c0897bb0b2e66078430d5e5b4cbc6f27d400be7a41be7efd59b2da12c17
|
||||||
ssa_ast: 393594ff11f2cda5ba5ca5f4638dfc1b976cbced62c26414cb6f3787bc59650b
|
ssa_ast: 35dc2d3b8ccc5cd4277132d66322e3c46d07e9f7ac53abd4c51893275eec56cd
|
||||||
|
@ -3,7 +3,7 @@ namespace: Compile
|
|||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: a76e3cbec17567bc7e5f8377c10fd50c145ab29ef6f915dd867c398412d9715b
|
- initial_input_ast: 8c88aa92e2f75c9e87085f5f02553aa660cecd69581cbcaccd29b27fd2d075a8
|
||||||
initial_ast: ebf8a008fb067b77d7483defca92ecfddd245f73f62470d99b06c4f82c7ef4fd
|
initial_ast: 9617cc65bc15eb1fa6ef3daa28a1d1e6befa0a754272ed3f1e8902711c9f8868
|
||||||
unrolled_ast: ebf8a008fb067b77d7483defca92ecfddd245f73f62470d99b06c4f82c7ef4fd
|
unrolled_ast: 9617cc65bc15eb1fa6ef3daa28a1d1e6befa0a754272ed3f1e8902711c9f8868
|
||||||
ssa_ast: 0ff15ecd2fe1e688bf2de9ca9ce5d28fbef3eb96d4277a1e8e907b5418e5fc56
|
ssa_ast: 6c34e63da14996d3fcd11967bc7075437352b276ca84edbc39e239a370032d63
|
||||||
|
@ -3,7 +3,7 @@ namespace: Compile
|
|||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: e57e2971deec32a3b718fd4acc86c7d71fc2acbdba6c81f28c2a510b3fa64947
|
- initial_input_ast: 30bcdf9e3064f59cff10bde5c59834ff95d21da38a9f0db7f12dee3017ae5887
|
||||||
initial_ast: c6609dd05a455d442e77e74d9674fe0b78f058ea7d39bd613cd0a3ed1fa8b737
|
initial_ast: c964668b045cb461255ec028c7ff47e22e8e64cc2b4d319332550268d8f812fb
|
||||||
unrolled_ast: c6609dd05a455d442e77e74d9674fe0b78f058ea7d39bd613cd0a3ed1fa8b737
|
unrolled_ast: c964668b045cb461255ec028c7ff47e22e8e64cc2b4d319332550268d8f812fb
|
||||||
ssa_ast: 713254e721a386bf17b91ae94815d344cb0e1e186b05dfbd8b976da2555c6bf7
|
ssa_ast: 59f2d4cbfa42518b6d01d7a997c37ce57f359bce237063b52071dbd125d36c2c
|
||||||
|
@ -3,7 +3,7 @@ namespace: Compile
|
|||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: a76e3cbec17567bc7e5f8377c10fd50c145ab29ef6f915dd867c398412d9715b
|
- initial_input_ast: 8c88aa92e2f75c9e87085f5f02553aa660cecd69581cbcaccd29b27fd2d075a8
|
||||||
initial_ast: 253c0b07c4c4dbe54760158ff1d49636694e544805c492182bdea4868c8fbc10
|
initial_ast: 4a1a4a5d4a5a3431e2c05495cbade311f82a48473ae50f21381d68b1cca46c92
|
||||||
unrolled_ast: 253c0b07c4c4dbe54760158ff1d49636694e544805c492182bdea4868c8fbc10
|
unrolled_ast: 4a1a4a5d4a5a3431e2c05495cbade311f82a48473ae50f21381d68b1cca46c92
|
||||||
ssa_ast: 835158424ce3d9b44cfa2a14e1e9b2bec1d2fbe245f4b17906bfa171242b4357
|
ssa_ast: 2c8f3d902d429bb3b7d89b3c6b15a42cf0d38d2d3673db077df2f6e7fb8d94c1
|
||||||
|
@ -3,7 +3,7 @@ namespace: Compile
|
|||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: 2b3b80f8bbbc37a19b90063fc5aef3ede42acae5cd7c283e112de1f9379cb3ff
|
- initial_input_ast: 43e7c413d898dd18070456e6875adbf73a93f3cd2703fc7f6bc7c793d8063bbd
|
||||||
initial_ast: 205bd154440ab96e5dece07a2502163fa5af0c71fdd77de5a63701c5f1253321
|
initial_ast: 5ae7882af5f6a744795df6b35b8bcbc34def145069cd58561e2d7b1a4c4da12c
|
||||||
unrolled_ast: 205bd154440ab96e5dece07a2502163fa5af0c71fdd77de5a63701c5f1253321
|
unrolled_ast: 5ae7882af5f6a744795df6b35b8bcbc34def145069cd58561e2d7b1a4c4da12c
|
||||||
ssa_ast: 05c7ffce246d0327645a88a24a01bad8a8aa2fdb99cd2d6b08857fd055f17f69
|
ssa_ast: 8e0e3dbb1c15e9e605cdd60f86a71b3b40884a3c618257637ae3f34a8972a7ad
|
||||||
|
@ -3,7 +3,7 @@ namespace: Compile
|
|||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: f037dfade413579955a2e52e6e96b71427af03d7defe97d47df88b0c73ca3690
|
- initial_input_ast: e4ca07cbf83cbb0689e77f23f535f3e207b95e02ced7b97c0e54181109e4e435
|
||||||
initial_ast: ca217c6f3aea50ceb8950ca5800e024aed65541460d32e4525b786297a35badf
|
initial_ast: da050bd06b235a73f9ef845b873d3ae9b20220524dcfe6a04591c2ff6056139d
|
||||||
unrolled_ast: ca217c6f3aea50ceb8950ca5800e024aed65541460d32e4525b786297a35badf
|
unrolled_ast: da050bd06b235a73f9ef845b873d3ae9b20220524dcfe6a04591c2ff6056139d
|
||||||
ssa_ast: fbf68197740665762e53fe739fc22ba921785e1aeba945c9f0093fc7a9f2fd43
|
ssa_ast: f1e9fe73ab40c7eda4bec6fe3e9c795dc5bc7752a57c8c896591da44fd28b226
|
||||||
|
@ -3,7 +3,7 @@ namespace: Compile
|
|||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: 8c4833854e62c3d51519f2858909f9c64e9864a11f55a82c8f7e7f6bd02fa823
|
- initial_input_ast: 320bf92be1f73a8faef64838d58c78d2c1b3bb305d4eff603e032995d9b4bca2
|
||||||
initial_ast: 1861d68bda8e64e4407e6da2418d6133bd032cbe454b400403ac1541ef5a38b2
|
initial_ast: 2349458411c2e3077ae34f501de4377809c52a588d7ec0e5672d0f1722048518
|
||||||
unrolled_ast: 1861d68bda8e64e4407e6da2418d6133bd032cbe454b400403ac1541ef5a38b2
|
unrolled_ast: 2349458411c2e3077ae34f501de4377809c52a588d7ec0e5672d0f1722048518
|
||||||
ssa_ast: 97480918a106fea32ce19bced3ec6bb4516e29ad928826729cc32df5601e80eb
|
ssa_ast: 89c5c83dc018118a8de6be933801240fff637075583b8a645898aa8708eb9063
|
||||||
|
@ -3,7 +3,7 @@ namespace: Compile
|
|||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: 8c4833854e62c3d51519f2858909f9c64e9864a11f55a82c8f7e7f6bd02fa823
|
- initial_input_ast: 320bf92be1f73a8faef64838d58c78d2c1b3bb305d4eff603e032995d9b4bca2
|
||||||
initial_ast: 6dbc7a6ea98ab36210dbe32f1d1e1634491d9c04ac5865ac1e3f486447f5f329
|
initial_ast: 622a7f73146c9c75e242ffd994b7e93b4d0e69eeb8e43e8fe7efc4119c263cdd
|
||||||
unrolled_ast: 6dbc7a6ea98ab36210dbe32f1d1e1634491d9c04ac5865ac1e3f486447f5f329
|
unrolled_ast: 622a7f73146c9c75e242ffd994b7e93b4d0e69eeb8e43e8fe7efc4119c263cdd
|
||||||
ssa_ast: bdbec8dc3f59954988a07ca7853ccb0982a8673ddb09f2f36a4ccfd005b786a6
|
ssa_ast: 3b131b64957ac0e22b22265a89fc80134824c6b4f7b5fe0e03758fc2d440e1b8
|
||||||
|
@ -3,7 +3,7 @@ namespace: Compile
|
|||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: 8c4833854e62c3d51519f2858909f9c64e9864a11f55a82c8f7e7f6bd02fa823
|
- initial_input_ast: 320bf92be1f73a8faef64838d58c78d2c1b3bb305d4eff603e032995d9b4bca2
|
||||||
initial_ast: 1ad15ca1e28d97305f3c1bdf0ee7fdd32ab3623b08c4934545adeb56463fd0ef
|
initial_ast: 7e96f01d3cbe223ce3fa26baaf7bb0eabfcb5bdb48cfa3b2529d7567fa606d8f
|
||||||
unrolled_ast: 1ad15ca1e28d97305f3c1bdf0ee7fdd32ab3623b08c4934545adeb56463fd0ef
|
unrolled_ast: 7e96f01d3cbe223ce3fa26baaf7bb0eabfcb5bdb48cfa3b2529d7567fa606d8f
|
||||||
ssa_ast: 4a6b3f37df80c57ba14b9f579106707f3a025102a9cd0b151828145a03a3f222
|
ssa_ast: 5affb5b905adfc42683ecbc09cbce3cff34497c9839ad73f3a95ffe3f38317b5
|
||||||
|
@ -3,7 +3,7 @@ namespace: Compile
|
|||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: fd4851f6581155b1e1f63488d141006413b52e2df042673193e838813134c8f8
|
- initial_input_ast: e742fe16a7df15d6f9c6b514f28746a9a5a48fda7e0bf6628601e84782878dd1
|
||||||
initial_ast: 3b2b884072048267d8433cb3d0d720823fe591c776066d13b4f433468808eef1
|
initial_ast: 7b15cc9c2c89267099e4c1a83c695cb19776bc428256fcae70b12286ed64e352
|
||||||
unrolled_ast: 3b2b884072048267d8433cb3d0d720823fe591c776066d13b4f433468808eef1
|
unrolled_ast: 7b15cc9c2c89267099e4c1a83c695cb19776bc428256fcae70b12286ed64e352
|
||||||
ssa_ast: e70d9df3b0cff002906ea599cb7c8873972d65fa5b3b7011f769fc496ff52b79
|
ssa_ast: 2254d7bf2518d280ed7701fe47724114f46baa36de0845d0e662f42d37404a46
|
||||||
|
@ -3,7 +3,7 @@ namespace: Compile
|
|||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: 7771059685b08997e10c889f701cab07503de86515a498e7e3b332eb0499bd80
|
- initial_input_ast: d25b5d30496f06387198d06e44a771e142f8e6592347c3849a8b3b957287f1b6
|
||||||
initial_ast: e4d2863962de0163515a775493ed831b2f06bb58bdbb7906de9e9a9f3c08db7c
|
initial_ast: f4d9dbfbba7f0b408d0db7bf4b142b064d350a2505c5b1de5dc1b780424db898
|
||||||
unrolled_ast: e4d2863962de0163515a775493ed831b2f06bb58bdbb7906de9e9a9f3c08db7c
|
unrolled_ast: f4d9dbfbba7f0b408d0db7bf4b142b064d350a2505c5b1de5dc1b780424db898
|
||||||
ssa_ast: 01a32cc3f75c557bed46fd3634337ed890a2e32bdc2ea24bbbdb2d3cae3bc5cf
|
ssa_ast: 975a2b0deb8ac7942a757a6069078c18dab7fe313b25eef4dba811bfd5ad29cf
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
namespace: Compile
|
||||||
|
expectation: Fail
|
||||||
|
outputs:
|
||||||
|
- "Error [ETYC0372017]: The type `Foo` is not found in the current scope.\n --> compiler-test:4:22\n |\n 4 | function main(a: u8, foo: Foo) -> u8 {\n | ^^^\nError [ETYC0372003]: Expected type `circuit Foo` but type `u8` was found\n --> compiler-test:9:22\n |\n 9 | function returns_foo(a: u8) -> Foo {\n | ^\nError [ETYC0372017]: The type `Foo` is not found in the current scope.\n --> compiler-test:9:1\n |\n 9 | function returns_foo(a: u8) -> Foo {\n 10 | return a;\n 11 | }\n | ^\n"
|
@ -3,7 +3,7 @@ namespace: Compile
|
|||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: e7f79b5056ddc163ce256bf7a04eb1a906e7603abd21f940890c5138c74ecd27
|
- initial_input_ast: 039af54743c15033383282d9a4fbada1272039efbb8248abad2667a472268038
|
||||||
initial_ast: 04e5363d319a4962436425cce40b8f5b47952f311b1141a60a71650089a2aeca
|
initial_ast: e624899be0135a92c25fde25504ad965a87a2bb44dfa460581f3a4399518e354
|
||||||
unrolled_ast: 04e5363d319a4962436425cce40b8f5b47952f311b1141a60a71650089a2aeca
|
unrolled_ast: e624899be0135a92c25fde25504ad965a87a2bb44dfa460581f3a4399518e354
|
||||||
ssa_ast: 2dc0a99f6fdc25ab1377c1ae6c8ce4d437310c749fc0bbba81faac88619aaca4
|
ssa_ast: afc1d80e038f131a7de54f00cb842623543f9c7e0fde4c5d8b2a396fe1473013
|
||||||
|
@ -3,7 +3,7 @@ namespace: Compile
|
|||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: e7f79b5056ddc163ce256bf7a04eb1a906e7603abd21f940890c5138c74ecd27
|
- initial_input_ast: 039af54743c15033383282d9a4fbada1272039efbb8248abad2667a472268038
|
||||||
initial_ast: e4810ac737afe750f188d08413eaf347c3ccfb2003d5649af5801bc76c341c81
|
initial_ast: 1b70efd847626c966937bb0112f0b7bdafa5a969924be55e9b6f86548fa01abd
|
||||||
unrolled_ast: e4810ac737afe750f188d08413eaf347c3ccfb2003d5649af5801bc76c341c81
|
unrolled_ast: 1b70efd847626c966937bb0112f0b7bdafa5a969924be55e9b6f86548fa01abd
|
||||||
ssa_ast: 8fa77b1ba6e516d45dca5d73b76d7aa9eba7e070699bd858f3a6eeec98ad8c7e
|
ssa_ast: fa0c99ca018e352b0535ca035f67ff17d88a78886df8263179f4e0e3a2fd0389
|
||||||
|
@ -3,7 +3,7 @@ namespace: Compile
|
|||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: a9d656cd719217c9df4fe73c1f6293aa89575e8c2f7d5e89a48c2c292a3e5e06
|
- initial_input_ast: 79308811ede3a2d4c490aadba0d40a914b4efdb8cd97ab3c9677f806673aec8d
|
||||||
initial_ast: 5ab8123c554f609d580bdfe6594f1d21d4a8cea0c5acbd31b019a2502c0187c4
|
initial_ast: ae0c1c8dca0049668d3592ec365cef35cf969f5ab26ed8abf9eab18e4668561a
|
||||||
unrolled_ast: 5ab8123c554f609d580bdfe6594f1d21d4a8cea0c5acbd31b019a2502c0187c4
|
unrolled_ast: ae0c1c8dca0049668d3592ec365cef35cf969f5ab26ed8abf9eab18e4668561a
|
||||||
ssa_ast: 91c2aa12786c1eaa46d3b8198e19c4e0c4205ed5993a19368dd5e0e87ba4b55c
|
ssa_ast: 04ee21bf86373f235d8d6b16a2fd719f70416dfe3c3adf5c422699407fd9efca
|
||||||
|
@ -3,7 +3,7 @@ namespace: Compile
|
|||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: 040a06927355054fb98cc4471807f0daceba0c3f7376346478ed5909f762d544
|
- initial_input_ast: 15e7c9d93b79f6ac900148264525a556e783fa4a482030968c0749a0f69b035e
|
||||||
initial_ast: eda442d3334351c3758ad67dbf74bc90a7fd5b2ead0d71cd35f44c7124b0e2f7
|
initial_ast: b29fdb415dc37f88b76cf02fd531cdf77bbb391d3a2392f643e043b737e4b5e2
|
||||||
unrolled_ast: eda442d3334351c3758ad67dbf74bc90a7fd5b2ead0d71cd35f44c7124b0e2f7
|
unrolled_ast: b29fdb415dc37f88b76cf02fd531cdf77bbb391d3a2392f643e043b737e4b5e2
|
||||||
ssa_ast: 7901ffc309a3384411543d9da0644b12935304562e9c9f57f760b689563ff760
|
ssa_ast: fb425621761505abd8e9e4b3cd6d7bd7da6b1b295a1e487cbcfc80f28afd237d
|
||||||
|
@ -3,7 +3,7 @@ namespace: Compile
|
|||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: 2d7031d44a212721505ffd13e275b705a910e6f803acb7fe2ff44a91b85dcd09
|
- initial_input_ast: 50c9794b0377757b37b71027a8f6264e9c2e1bdde040b3946b89521ce9a2fda6
|
||||||
initial_ast: 4b4f649b12d3c262c39f44346808961daa870d488a56affdeedce5b71f3a6251
|
initial_ast: a4e144cc9cc78f59672e65ce086ac6994cd3f035662f3c311ef21c7d511509ef
|
||||||
unrolled_ast: 4b4f649b12d3c262c39f44346808961daa870d488a56affdeedce5b71f3a6251
|
unrolled_ast: a4e144cc9cc78f59672e65ce086ac6994cd3f035662f3c311ef21c7d511509ef
|
||||||
ssa_ast: e7f219c4567593af2f0d60731e1149ed0f807ba9dddae2c0b6e79e07bb30a642
|
ssa_ast: 55eb686c1797e5df96654434e580b7604391f68afc4de946711d8fb5d3909f5a
|
||||||
|
@ -3,8 +3,8 @@ namespace: Compile
|
|||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: 0073bbe6842eb1f47d4bd0d9a69f2cef9ceab14f7c6fee9cb64de09db43504dc
|
- initial_input_ast: 3c529c8d7cc460b8b3c2594fcc404fc454a6f9f6bf404f6e58ef0b9d0ac0bcea
|
||||||
- initial_input_ast: f71ddbed9223717e966b06bf8f763bbff72630ca1d3cc111aab9d0d3e1e5c939
|
- initial_input_ast: adf28e234235b1bd389c5d33b44d415423d7f6e55321fb82f6b70be1810de213
|
||||||
initial_ast: 9a0e14d58fde3dd3891729dcd524c230883326853cb855d25613bf8c94e3b0f5
|
initial_ast: 501c1fdf52b3ebc30c9db8f01617375d30b328ae9df59e3dfd20bae9778ee100
|
||||||
unrolled_ast: 9a0e14d58fde3dd3891729dcd524c230883326853cb855d25613bf8c94e3b0f5
|
unrolled_ast: 501c1fdf52b3ebc30c9db8f01617375d30b328ae9df59e3dfd20bae9778ee100
|
||||||
ssa_ast: 6229f23d969ccd869065a04d250fd115eed56e412025a4f0be1fa3db39b94432
|
ssa_ast: 867fe524b8b0f0357579ba91fd2ca86a38f0a17676faee953687a2d34853f0e1
|
||||||
|
@ -3,8 +3,8 @@ namespace: Compile
|
|||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: 9c8c671f61b95462337ca91e8f834c10a6ef9396c194311735617e6a89433d5e
|
- initial_input_ast: d5091be026ee55218e4b4f064008f87bc05e1052fed135b68c3e3014d448d319
|
||||||
- initial_input_ast: f1fd221ab17b979c2f0d93dde9cba7ec1321a4c50ff2dc2692b562b96bd947e4
|
- initial_input_ast: eb0db3f61bc7199a31443d1bb3a75c62678b3da03c299a984cb1e1ede94aa507
|
||||||
initial_ast: 1d79f9cbad0a1a9a3af89388783ea7768ebb3ed4805465a3e7f13ce891a4eeb8
|
initial_ast: c8be4378ceb6988bdc1ec98a7d66b3de68cee0867dc6d1b9b0a43a45ce88f8df
|
||||||
unrolled_ast: 1d79f9cbad0a1a9a3af89388783ea7768ebb3ed4805465a3e7f13ce891a4eeb8
|
unrolled_ast: c8be4378ceb6988bdc1ec98a7d66b3de68cee0867dc6d1b9b0a43a45ce88f8df
|
||||||
ssa_ast: efe219dc01c0e8d852d938b07b1b0dd61eff0365ef3bc601b5630db4c4a4e9fe
|
ssa_ast: a8e6273034a7581c4a37b73039e3f496dff93c83260b63742bbc1e633e345d43
|
||||||
|
@ -3,8 +3,8 @@ namespace: Compile
|
|||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: 0073bbe6842eb1f47d4bd0d9a69f2cef9ceab14f7c6fee9cb64de09db43504dc
|
- initial_input_ast: 3c529c8d7cc460b8b3c2594fcc404fc454a6f9f6bf404f6e58ef0b9d0ac0bcea
|
||||||
- initial_input_ast: 2dc9355aaf9107b66bf59810782af1964d420417e65fa74b7930c04991c6333c
|
- initial_input_ast: 4e63736fd3aecff398414ac7d2625d79ab5fb81ee9eec0e3e28eeadd95d12e56
|
||||||
initial_ast: dbd2129ee38a1ddc39eee3aa4d75143a9758b6d336b0b7e91d30cca609ba8f23
|
initial_ast: 29d2956fb510170b995f99541ff8a58a42a482467bcf4131f077c790b6bb7dc7
|
||||||
unrolled_ast: dbd2129ee38a1ddc39eee3aa4d75143a9758b6d336b0b7e91d30cca609ba8f23
|
unrolled_ast: 29d2956fb510170b995f99541ff8a58a42a482467bcf4131f077c790b6bb7dc7
|
||||||
ssa_ast: 17828ce1eb4f3ec1b9178962a7b2bc3ed2a472dc661adf4e20d2545c28ed13ee
|
ssa_ast: 04e31373812d61e5f8f7ec7df36029e0157e1a97b8d747527380701449353a08
|
||||||
|
@ -3,8 +3,8 @@ namespace: Compile
|
|||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: 839e61ab19309760f1b478b897e337bb8cf6e4bb218e926883ed9444d51d8a28
|
- initial_input_ast: 6cbc303a565783de6a9aa6f963e27659d89d56c4106803e4387bdf5158df114d
|
||||||
- initial_input_ast: 58cecb481ced6587e9ee954f76df79d810747054149b30e21c94d1cb45f9bac9
|
- initial_input_ast: 5d6aa3cebc88676c91bf621ae27eaf39fbb9babec171b2df88d8970d5fea5d9b
|
||||||
initial_ast: 8357a13fe26f60ed22001d2d861bf0043f12d804be36e41f4265d80df3e0ed18
|
initial_ast: c7318d0126271c747105e963a68073430fa15c21aab859305f6b87fc5d8c0e5b
|
||||||
unrolled_ast: 8357a13fe26f60ed22001d2d861bf0043f12d804be36e41f4265d80df3e0ed18
|
unrolled_ast: c7318d0126271c747105e963a68073430fa15c21aab859305f6b87fc5d8c0e5b
|
||||||
ssa_ast: f5ab6db08078729bfd119493c68b9caf3751b28528deb5dba0f2a1e188a7bcf6
|
ssa_ast: 74c97eb0e249b30d63d9279ca87f6e111130ada0ed04df693fa1e819a921e7e9
|
||||||
|
@ -3,7 +3,7 @@ namespace: Compile
|
|||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: 0c988849087349f8f3fc79a2992efbb2d085c528c76f92f323efb856d678170c
|
- initial_input_ast: 79da2a39d3ce373fda219a5f4d946dfde01a8dbee50e2dfcffbfc892bf6d123f
|
||||||
initial_ast: 127bd2f2dfc26310382ac2a45b3001e9f8a79f3fd9c6fcaaf03083fd59acf947
|
initial_ast: f1a9651b746900f9c1086ef336d61ec6119faaa144e0034b213116f33ae2d41f
|
||||||
unrolled_ast: 127bd2f2dfc26310382ac2a45b3001e9f8a79f3fd9c6fcaaf03083fd59acf947
|
unrolled_ast: f1a9651b746900f9c1086ef336d61ec6119faaa144e0034b213116f33ae2d41f
|
||||||
ssa_ast: fded1c4ff0a5c5adc5b286631206948b74639e304fff76ae5d3cab8c1b0992b6
|
ssa_ast: 0f47e67aac75a16abc51034267d9c71e5af15803bb9aa346bc1ca2f982ec4b2e
|
||||||
|
@ -3,7 +3,7 @@ namespace: Compile
|
|||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: 42d3d2a95ecf42808533fc38c7765957dd86f6d84679e6db05141f14078d1723
|
- initial_input_ast: a7f556e6d66a954ec5c7b4a8f326257e7c5535125bcb62db30aeb9668d4a4019
|
||||||
initial_ast: a835c5cdf987d342c5fe92633a62939a513b7135acb8b0a7caafd369b3f197ff
|
initial_ast: b8fca4461143590bb1ad98f1212c14459d9db111c6c9d072aa31b79612364b9e
|
||||||
unrolled_ast: a835c5cdf987d342c5fe92633a62939a513b7135acb8b0a7caafd369b3f197ff
|
unrolled_ast: b8fca4461143590bb1ad98f1212c14459d9db111c6c9d072aa31b79612364b9e
|
||||||
ssa_ast: 646087bb3a3332f84128e3f123ddadad7861447132e3060feeca1cd039b34cab
|
ssa_ast: be0e248c821ce8d41b0aa8e061444d021162e3cade64cabaf1782dc31eeec6a8
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
---
|
---
|
||||||
namespace: Compile
|
namespace: Compile
|
||||||
expectation: Fail
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- "Failed to parse string. Parsing Error: VerboseError { errors: [(\"closure main:\\n neg 170141183460469231731687303715884105727i128 into r0;\\n sub r0 2i128 into r1;\\n output r1 as i128;\\n\\n\\n\", Nom(Tag)), (\"closure main:\\n neg 170141183460469231731687303715884105727i128 into r0;\\n sub r0 2i128 into r1;\\n output r1 as i128;\\n\\n\\n\", Nom(Alt)), (\"closure main:\\n neg 170141183460469231731687303715884105727i128 into r0;\\n sub r0 2i128 into r1;\\n output r1 as i128;\\n\\n\\n\", Nom(Many1))] }"
|
- output:
|
||||||
|
- initial_input_ast: c73d747914473c57db75df7fd1672a0675b56394dca1ed1fb3536f6777c86d80
|
||||||
|
initial_ast: a5aa8ea645fd06ab5886a7036858583c7635735040c464068142dc6f5cc56b0f
|
||||||
|
unrolled_ast: a5aa8ea645fd06ab5886a7036858583c7635735040c464068142dc6f5cc56b0f
|
||||||
|
ssa_ast: db807469612306919568dd4427372ee4da200d215059658f1bf03d802e5924b5
|
||||||
|
@ -3,7 +3,7 @@ namespace: Compile
|
|||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: e598def825099f6b2617d39059b877cf49137140ce1e095415a9875b8e0e637d
|
- initial_input_ast: cc4bb320d4e0a99758a94b8f64a2e3da7469cd00db94156b05b3dc7d97173dc0
|
||||||
initial_ast: 0da749b9b44d40858426f14431bf864d457dcfd2a394fa8e5d89bfef3412a9bc
|
initial_ast: 512828f9b059c5715d2650edba209b32a167152da19f915bcb7738c8c3c5a771
|
||||||
unrolled_ast: 0da749b9b44d40858426f14431bf864d457dcfd2a394fa8e5d89bfef3412a9bc
|
unrolled_ast: 512828f9b059c5715d2650edba209b32a167152da19f915bcb7738c8c3c5a771
|
||||||
ssa_ast: bd167e08296a7c4962cac68e653c9c2cd382915c7d7a2f8292eb65cde6c9e1be
|
ssa_ast: 9d3bc29df6312205e2f913d8d274d3afaf2769c98b2b31cdf23cfb585fc7d491
|
||||||
|
@ -3,8 +3,8 @@ namespace: Compile
|
|||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: a20467288639231bd180d7ff942a339170dbefb26440a24c8907efa8ba941f7f
|
- initial_input_ast: cb902874c03a9409774f0e1f3c2225d392f49ff46774d795599dd72bbe44f9cd
|
||||||
- initial_input_ast: afa4aa7f9a7280ec3553bc674b4a00d473978805198e715b726b43e17d142af3
|
- initial_input_ast: a1857946296862e584d879ddb5d5901b22cae5ea864bafc43de453ba9d99eb38
|
||||||
initial_ast: 7295cf0eb725e557e0fba2b60786dc1fbdea6c46f13ede2c57ea2398a4c4d90f
|
initial_ast: a7d37ad9f764b871f328f82b3d3c50a849cb94a31bcdf92fdcaf4d16651b5a27
|
||||||
unrolled_ast: 7295cf0eb725e557e0fba2b60786dc1fbdea6c46f13ede2c57ea2398a4c4d90f
|
unrolled_ast: a7d37ad9f764b871f328f82b3d3c50a849cb94a31bcdf92fdcaf4d16651b5a27
|
||||||
ssa_ast: 6540798d78cbcf495205233e8139f00bdf8ee2f34b522cd9fd1dcec236046a44
|
ssa_ast: 7580a7b771a9a79c5ce85757dd937caa3ce14ced57fe5a6d04b6b2f281b61005
|
||||||
|
@ -3,8 +3,8 @@ namespace: Compile
|
|||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: b8ec17eea6039a34b9e77c74f445c43a4c0802f9cfe8ff86e84c5954c247e49f
|
- initial_input_ast: 03f9c9174959a180ab0cff4fd139efad96ca1e9e63c78acada0097a065a1afff
|
||||||
- initial_input_ast: 6c116007a92625c046449f00e89d6ed09d20f8806cf7139946800cca5b18e688
|
- initial_input_ast: 4537564bdc7b22346f16c5bb36ed4dbacafa3bc973f4cca857b7a9fa4e148ba4
|
||||||
initial_ast: 3dc2d25c4df9618e4a6bec9cfecafd49a502b74b2655adfbd2498a36a024aed3
|
initial_ast: c5c9641ec3b8a94b1b3462d873f7a613b228c3427224216e3b1d635888aa3564
|
||||||
unrolled_ast: 3dc2d25c4df9618e4a6bec9cfecafd49a502b74b2655adfbd2498a36a024aed3
|
unrolled_ast: c5c9641ec3b8a94b1b3462d873f7a613b228c3427224216e3b1d635888aa3564
|
||||||
ssa_ast: dce6ca6d8021939acb48603e42157edf3ca09c703ebc8b899c859ff1c70477a9
|
ssa_ast: fe06d7657a54e164ea344df81fec6ed3485e3ed9fd81fc41817db7b784c45e63
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
---
|
---
|
||||||
namespace: Compile
|
namespace: Compile
|
||||||
expectation: Fail
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- "Failed to parse string. Parsing Error: VerboseError { errors: [(\"closure main:\\n neg 170141183460469231731687303715884105727i128 into r0;\\n sub r0 1i128 into r1;\\n neg r1 into r2;\\n output r2 as i128;\\n\\n\\n\", Nom(Tag)), (\"closure main:\\n neg 170141183460469231731687303715884105727i128 into r0;\\n sub r0 1i128 into r1;\\n neg r1 into r2;\\n output r2 as i128;\\n\\n\\n\", Nom(Alt)), (\"closure main:\\n neg 170141183460469231731687303715884105727i128 into r0;\\n sub r0 1i128 into r1;\\n neg r1 into r2;\\n output r2 as i128;\\n\\n\\n\", Nom(Many1))] }"
|
- output:
|
||||||
|
- initial_input_ast: bebb28a7f8a3f608d135f8e25ddff07a36e01448741c59b662c8d6f98a7f302c
|
||||||
|
initial_ast: 274c41a99717c990553f9f21404ef3fa78a992e81d8db0b9c866be2b1365add9
|
||||||
|
unrolled_ast: 274c41a99717c990553f9f21404ef3fa78a992e81d8db0b9c866be2b1365add9
|
||||||
|
ssa_ast: ae4a25d296a61714c14209db27c3e9da80c3f9af2b5f0bba0a3cfadf6f8c82cc
|
||||||
|
@ -4,6 +4,6 @@ expectation: Pass
|
|||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: 5b85c589bd5729444d6aad8fa52e8f17f93b026a8e3991766fa304ed7a57aa78
|
- initial_input_ast: 5b85c589bd5729444d6aad8fa52e8f17f93b026a8e3991766fa304ed7a57aa78
|
||||||
initial_ast: 09bcefee1e16874bfc4b1ff8722756e23d67135e2fd56014ed1905ba33936ed6
|
initial_ast: 5e3da2a1b4010d891aaa02fcc6768bb2e264adb72f2f63fc317d19a3f66cae78
|
||||||
unrolled_ast: 09bcefee1e16874bfc4b1ff8722756e23d67135e2fd56014ed1905ba33936ed6
|
unrolled_ast: 5e3da2a1b4010d891aaa02fcc6768bb2e264adb72f2f63fc317d19a3f66cae78
|
||||||
ssa_ast: 47309b2dadcacb59e23ecce52f295b04d832483bd2c597fe456c5288e426337f
|
ssa_ast: caa03ee56042bb8d23f0fe133158146d5edc6fca695419324ac895fd09f7532f
|
||||||
|
@ -3,7 +3,7 @@ namespace: Compile
|
|||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: 61eac183bae63ae8192f044c59a37feaea409f56b8c3c93bdeb00b8fb2e7dfb1
|
- initial_input_ast: 0177c7eed02c77740d71258108323ec082e7625abdf9cf5d3e9a2c5151262d99
|
||||||
initial_ast: 72b63e1fa3e176c6171fc99a7745cca6499f1282f53818e02d5397848e8a7ee2
|
initial_ast: 170f2d6786366bf2e99030153ee3e32efcdedc6a4549edbbb248f23c5a80ffad
|
||||||
unrolled_ast: 72b63e1fa3e176c6171fc99a7745cca6499f1282f53818e02d5397848e8a7ee2
|
unrolled_ast: 170f2d6786366bf2e99030153ee3e32efcdedc6a4549edbbb248f23c5a80ffad
|
||||||
ssa_ast: a5ecd348910ca4785a4f5754e4b5b45ab43742b2693556fd1648de0c47efc2cc
|
ssa_ast: cbe007e222c59381eecb3715e333c091a2250e82b41f4082726f9900319bbe6c
|
||||||
|
@ -3,7 +3,7 @@ namespace: Compile
|
|||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: e7f79b5056ddc163ce256bf7a04eb1a906e7603abd21f940890c5138c74ecd27
|
- initial_input_ast: 039af54743c15033383282d9a4fbada1272039efbb8248abad2667a472268038
|
||||||
initial_ast: 517119de93baf717228127edf46ac737e3945649892a70e661d9979ec962b21a
|
initial_ast: 7a582c2c4f99ea4140b26de6e41cd65809710a6a908b2fe502ca3c43b3fe5e8f
|
||||||
unrolled_ast: 517119de93baf717228127edf46ac737e3945649892a70e661d9979ec962b21a
|
unrolled_ast: 7a582c2c4f99ea4140b26de6e41cd65809710a6a908b2fe502ca3c43b3fe5e8f
|
||||||
ssa_ast: 49f6fa2d491d88cfb4307f784c48e43a6002e873b545733220029413b78a201f
|
ssa_ast: 1580168120145940540b77ed83942f4f6c72c5261a22ec599ded15efa536a941
|
||||||
|
@ -3,7 +3,7 @@ namespace: Compile
|
|||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: 965a2a9889ffac2b94872375270953221ad1785aed55c8bc139b4bc70a7230cb
|
- initial_input_ast: fc1e1ab7acff26b62b719506922cd02b116f446510fafb1181186474528de408
|
||||||
initial_ast: 998c59a5e826dab3e73d8d16f596773c19026b63d6f6baf093cf696951a2639f
|
initial_ast: 45cc8c1b28acef1231cd9d5658665600cca2579fe64e7fbcc4cff3df565511e1
|
||||||
unrolled_ast: 998c59a5e826dab3e73d8d16f596773c19026b63d6f6baf093cf696951a2639f
|
unrolled_ast: 45cc8c1b28acef1231cd9d5658665600cca2579fe64e7fbcc4cff3df565511e1
|
||||||
ssa_ast: f9e04dc07cd87aab28d4b4afc03032eaf69f86973d677fbf3d7f23a9ea15ca8d
|
ssa_ast: c2c13b08e12456df6d52c58b80eb26f8b9ef9a36faed701dc1167e90d03539c4
|
||||||
|
@ -3,7 +3,7 @@ namespace: Compile
|
|||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: 040a06927355054fb98cc4471807f0daceba0c3f7376346478ed5909f762d544
|
- initial_input_ast: 15e7c9d93b79f6ac900148264525a556e783fa4a482030968c0749a0f69b035e
|
||||||
initial_ast: 2109e52172d6b88e9d2b2218e37ed1e0cb9e9b7ef277dd3c58a01a4086c477c4
|
initial_ast: 83107718cf4f8becbd2a2f6d6e9b3156e6e3f3cbb77d9e1727db1b13d4e031f7
|
||||||
unrolled_ast: 2109e52172d6b88e9d2b2218e37ed1e0cb9e9b7ef277dd3c58a01a4086c477c4
|
unrolled_ast: 83107718cf4f8becbd2a2f6d6e9b3156e6e3f3cbb77d9e1727db1b13d4e031f7
|
||||||
ssa_ast: 865fd700a395677730123776b94f9a0647441e559f2adebf7e61f437803d3e30
|
ssa_ast: 03351383c6c5a6e60bc9c0d46757f8379ee5c38d8e67ff31a50bed3bcdd4c174
|
||||||
|
@ -3,7 +3,7 @@ namespace: Compile
|
|||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: 049cd06c422de7247df7f0e2a1ad98429c613a941f5ece0a791e149434612580
|
- initial_input_ast: dcc462f54ea6ca5718527bd01c96bafa3a9d8d42b539db23b6f570867441b2c0
|
||||||
initial_ast: af6e287228b8cb6f6755b8eeea019c3f9a9da648f1da6451c4ef31c7301e39d1
|
initial_ast: 005ffe05a09cfcdb965f199031066eb338044abfbd21a4fb23af0d110cf7fc76
|
||||||
unrolled_ast: af6e287228b8cb6f6755b8eeea019c3f9a9da648f1da6451c4ef31c7301e39d1
|
unrolled_ast: 005ffe05a09cfcdb965f199031066eb338044abfbd21a4fb23af0d110cf7fc76
|
||||||
ssa_ast: b52e4a0ba681f19d4769ff88863c870f1c89fc6071dd17ebac0308087d5496be
|
ssa_ast: 071d6705f1587ac581237d2f815b797592e646d546a1e9eed5d4b8c81cdcd31f
|
||||||
|
@ -3,7 +3,7 @@ namespace: Compile
|
|||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: 049cd06c422de7247df7f0e2a1ad98429c613a941f5ece0a791e149434612580
|
- initial_input_ast: dcc462f54ea6ca5718527bd01c96bafa3a9d8d42b539db23b6f570867441b2c0
|
||||||
initial_ast: f7e13d9f0d4c80aa93a32c30bf4a6503b21f0dc4e51d204f50f9afe952f4d89f
|
initial_ast: 80e4e5aaf431d55251d5918834b4e8ce2ade81e2048651a539b52f0c0de0fb04
|
||||||
unrolled_ast: f7e13d9f0d4c80aa93a32c30bf4a6503b21f0dc4e51d204f50f9afe952f4d89f
|
unrolled_ast: 80e4e5aaf431d55251d5918834b4e8ce2ade81e2048651a539b52f0c0de0fb04
|
||||||
ssa_ast: 857780dbeb54b3f88f6ea68fa7cd7f78641e4293ab4ecd757cac27c73b7e43c5
|
ssa_ast: ad205558957eba8df61590f96aa3db1a9291efabee5a3b48c907bb840ae7c7e4
|
||||||
|
@ -3,7 +3,7 @@ namespace: Compile
|
|||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: 3400af7ad9d967ebee212ba94102763b1e3d78c40cfcfb21e1496544111a842b
|
- initial_input_ast: 1a5fe4b85de6981afcc4c53e54ddfc72e5898e737875b4108d495fce8aa23194
|
||||||
initial_ast: a825840684e68553816c9c56419356888517c81d3111590d17c228fc9ad5fcba
|
initial_ast: 4bd6afc807895ea63bc61e1157cbdac6de281dc465763914f34ab732203f7e17
|
||||||
unrolled_ast: a825840684e68553816c9c56419356888517c81d3111590d17c228fc9ad5fcba
|
unrolled_ast: 4bd6afc807895ea63bc61e1157cbdac6de281dc465763914f34ab732203f7e17
|
||||||
ssa_ast: 7cfa241ad77363631a30871d2dc3f485ec8b9e55da008deb397915ec7f7d8d10
|
ssa_ast: 252c8d727e69d55203339a7b29bf5972f21553d85718a060005db94b9e9c5763
|
||||||
|
@ -3,8 +3,8 @@ namespace: Compile
|
|||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: 513958b9ca8c081b703e39f4c99751d60bf8e8a8b2c198b57b50dab7c5af3327
|
- initial_input_ast: 90608a4dc4fe1c76f2ca875129ae9038d3d0585a6c671e4efca827af29dbdfc1
|
||||||
- initial_input_ast: 7be5155718612a25f8eadba1a6e8cde45c7806ce99f4ede89a7a5acdfc5966ca
|
- initial_input_ast: 579a49a1239e4c5e70cc3d3f40256a55f1d4f4d250dc9e71dab89b292f77bce5
|
||||||
initial_ast: 9146d98fbb82e6e0321a9a630b940993910aa29648c153be7a2330b95ae01e4e
|
initial_ast: 3396decc2d51d008352eac007a71b65b5f0be4924d3810af12e87d306b27fa0b
|
||||||
unrolled_ast: 9146d98fbb82e6e0321a9a630b940993910aa29648c153be7a2330b95ae01e4e
|
unrolled_ast: 3396decc2d51d008352eac007a71b65b5f0be4924d3810af12e87d306b27fa0b
|
||||||
ssa_ast: d7a6af105d6e8b4d0b2a0b6f452b97a6b9cfb52b7813d591c8a756f801267db4
|
ssa_ast: fb96832d0d1be2dd436771b029fe9e696a36290c0cdedff10e0087a34954a520
|
||||||
|
@ -3,7 +3,7 @@ namespace: Compile
|
|||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: f686fc3d84ba39af944ba435926d6ed9dee6b6bcb7548a72d3da169b80b6fdd8
|
- initial_input_ast: 3b6b12b624fce460422e119724836696bf4446f9f26feff0e5d76f7e345f4573
|
||||||
initial_ast: cb92e2927b3f4f81e7e893ff99614304243ac40637dce6b15fab5356a7ce212c
|
initial_ast: 2bfe0bb6c317e1a42e99f8c9211f5c9876bdaba75adf6a3dbe014bb8e137fdc0
|
||||||
unrolled_ast: cb92e2927b3f4f81e7e893ff99614304243ac40637dce6b15fab5356a7ce212c
|
unrolled_ast: 2bfe0bb6c317e1a42e99f8c9211f5c9876bdaba75adf6a3dbe014bb8e137fdc0
|
||||||
ssa_ast: eb4a86210215fde28b85389e063317dfd55cebdff078fc4a05b2d9feeb578224
|
ssa_ast: 4b831d3949c00c3a03aa836eade6af0cad8731652e1c5c0a4f661f7f0d147785
|
||||||
|
@ -3,7 +3,7 @@ namespace: Compile
|
|||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: f2735a0950a2843a36c064271415244f527dee4a3e53e5115bf1954c50ed4808
|
- initial_input_ast: 40307e11e7c825f8af2ba9d98ba89534834e5816500737ac4d4d2507063f0497
|
||||||
initial_ast: e1aed63fee648b767384037e8aeeb1eac7bf05874c3ac16a98bd58ae3fa54495
|
initial_ast: d7b601eaca170549bf3d678fde9e8c3afad2f09a11d24f0f20439f6cf097a5bc
|
||||||
unrolled_ast: e1aed63fee648b767384037e8aeeb1eac7bf05874c3ac16a98bd58ae3fa54495
|
unrolled_ast: d7b601eaca170549bf3d678fde9e8c3afad2f09a11d24f0f20439f6cf097a5bc
|
||||||
ssa_ast: 3e2666c11cb7a3287e4ac2d2632b3fc288a0332879ba6f5b377752da44f89b9a
|
ssa_ast: 76eaf3717af74178ccd8a3747d1c583c2d8dd7001d6d54bb3d3e7f856652421c
|
||||||
|
@ -3,7 +3,7 @@ namespace: Compile
|
|||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: f2735a0950a2843a36c064271415244f527dee4a3e53e5115bf1954c50ed4808
|
- initial_input_ast: 40307e11e7c825f8af2ba9d98ba89534834e5816500737ac4d4d2507063f0497
|
||||||
initial_ast: 604433a3de4dedc6a8a8ef418e0a616b3a66ea1f3f2bfbff767726b9d971681f
|
initial_ast: 43d1e3a865fae24774afbccdd5f12bd30a964cdc85e0403d25ade9d89f273496
|
||||||
unrolled_ast: 604433a3de4dedc6a8a8ef418e0a616b3a66ea1f3f2bfbff767726b9d971681f
|
unrolled_ast: 43d1e3a865fae24774afbccdd5f12bd30a964cdc85e0403d25ade9d89f273496
|
||||||
ssa_ast: 9e1e6b894fbcc1979f0f96de658477cc5e1313de19c47feb14963f0638fc9ac2
|
ssa_ast: 104e42a06b0cda9a3ab4f790e386a0fda96062f8aaa0fcb64be2df1a357df931
|
||||||
|
@ -3,7 +3,7 @@ namespace: Compile
|
|||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: 9986979e83203ebe5400f735d48cbeb65142f8b858a3b604c99b6e5d6bfeb167
|
- initial_input_ast: aabcbfbe3c7ad948859c5594b0a8aa0da06f84502dab69e1f74cbf15964169bc
|
||||||
initial_ast: 0cff7268ed011d4658fe162cd2c788c79411970f36654341a486ddcae583d78f
|
initial_ast: 980488b313c96fb22bfa83a0a4fbbff4e7bcc98af66b8e826be0319fdb0c8ea0
|
||||||
unrolled_ast: 0cff7268ed011d4658fe162cd2c788c79411970f36654341a486ddcae583d78f
|
unrolled_ast: 980488b313c96fb22bfa83a0a4fbbff4e7bcc98af66b8e826be0319fdb0c8ea0
|
||||||
ssa_ast: ffdf060169c4a8c92815c0a33f18c07d770a4ee6cc3686ca8a95e90927998c46
|
ssa_ast: 99818913a8119d8c1942a44de7aa2562604c0816c841e958be4184185810e83b
|
||||||
|
@ -3,7 +3,7 @@ namespace: Compile
|
|||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: 284cc306edf57a02339ef2560f21ce29808d1bce42ab36402091e814e39c9fb6
|
- initial_input_ast: d176e8f3f8e1c2fdba4f650075f34212caad33f2d09ec00cf99e806ed08f7d01
|
||||||
initial_ast: 402b3835d4a638d4bf1c62f92038184012dd89390cdccff0b2fef49996323096
|
initial_ast: 1f5bebfb20262bf97da698e2ff16faa861f1242a572341825e3b80a51552066a
|
||||||
unrolled_ast: 402b3835d4a638d4bf1c62f92038184012dd89390cdccff0b2fef49996323096
|
unrolled_ast: 1f5bebfb20262bf97da698e2ff16faa861f1242a572341825e3b80a51552066a
|
||||||
ssa_ast: f26955234e3e713f2d1c64de779522f751b758f04e35006af728d108457525c8
|
ssa_ast: 679323ec8be6ee1b24fc248fd4b4d0287920a3944c3a971af366a23ea4379094
|
||||||
|
@ -3,7 +3,7 @@ namespace: Compile
|
|||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: 31328c147e6bd03afc7ae3611332b408f605b56416363b73f603c8035c601395
|
- initial_input_ast: 9f4e840f09f05a9d5a333a7556c1e06fa92a9285b2b100e15e845c0728d0b1d1
|
||||||
initial_ast: 7f0fef0753723a803a47c275be57fdf960bbf6e5d3683f86ab593ed4b1ef6349
|
initial_ast: 31637a72e7b3710464bc4bbb2250385f22839d1855311d157025787b0225ddae
|
||||||
unrolled_ast: 7f0fef0753723a803a47c275be57fdf960bbf6e5d3683f86ab593ed4b1ef6349
|
unrolled_ast: 31637a72e7b3710464bc4bbb2250385f22839d1855311d157025787b0225ddae
|
||||||
ssa_ast: 81573fbb9b726887f7b09d2c09ed5f55919b5d611d6474c2c558e633da14656f
|
ssa_ast: f6c7207f9a927be42ed882efb2a40baf00c364413b8679aed3736e27bc8dfecb
|
||||||
|
@ -3,8 +3,8 @@ namespace: Compile
|
|||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: 84737613983ce8d5980d79c278d0df7581a2b67253b1e8e5f5e78187592cb736
|
- initial_input_ast: 1e3bc80186397460f0d7fdbca7bfc8c4a2c65ea8f544f12f8cbf987520327a70
|
||||||
- initial_input_ast: 24dc5feb0a4a2c1c380b49392fb1a05f8ddcc6754b6b5561a334ad264a8e2904
|
- initial_input_ast: c5c783e56584d35218b1794b0cc2b78527e882c2d120abff2f6f62a9bd9f4d1b
|
||||||
initial_ast: 987f064325cfd98f260555625ed121eaf030fb890f23a1094f831edbd368b40a
|
initial_ast: 1f3ed866641cf8d3ae3664e58f40a5551eecb6bff6b3845ecc1ae208cd2d7b2e
|
||||||
unrolled_ast: 987f064325cfd98f260555625ed121eaf030fb890f23a1094f831edbd368b40a
|
unrolled_ast: 1f3ed866641cf8d3ae3664e58f40a5551eecb6bff6b3845ecc1ae208cd2d7b2e
|
||||||
ssa_ast: 161265e76c7ccebbbc053353cb5244d903dd896a674a4110d083e8caa131680b
|
ssa_ast: e9a4899bc3336b36506135c032dc3be02bba8aa3ad040b64c84665099e6f1615
|
||||||
|
@ -3,8 +3,8 @@ namespace: Compile
|
|||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: ce03fd3769c534ade9d6db8593ddfbb5bffedc449a0c12ec4ef4ee0847a1d63c
|
- initial_input_ast: 96bd5d5fadb142f2d4584560f23c06453171ac46bce758962d3fa62d3de826b9
|
||||||
- initial_input_ast: fdd90f054b5d5bfc4126eb950c18a4465d6940e618e373b8b6aa6b79c5df43ed
|
- initial_input_ast: 55d6f4c3055a015f300fddd93616965b5a8c6339ee3c8a052a1a3ca43131c75e
|
||||||
initial_ast: f787e2e4c1e71549bd6feeb7693dbc7c7551328046627a682c4017f51134d6a9
|
initial_ast: fbc02cf7cffe67acc2ba54a65d5c7f6185c4bd908d6d41948c273f7a6351fbca
|
||||||
unrolled_ast: f787e2e4c1e71549bd6feeb7693dbc7c7551328046627a682c4017f51134d6a9
|
unrolled_ast: fbc02cf7cffe67acc2ba54a65d5c7f6185c4bd908d6d41948c273f7a6351fbca
|
||||||
ssa_ast: b3380eefb97d14a6cd022155ef247ce852bb1d0d4ee9464c1535fdf791c60f62
|
ssa_ast: b0db21a84ff1ddc99ba36b28e294e26bca852c21ac60041c01ba059d4c93f47f
|
||||||
|
@ -3,8 +3,8 @@ namespace: Compile
|
|||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: 84737613983ce8d5980d79c278d0df7581a2b67253b1e8e5f5e78187592cb736
|
- initial_input_ast: 1e3bc80186397460f0d7fdbca7bfc8c4a2c65ea8f544f12f8cbf987520327a70
|
||||||
- initial_input_ast: a18db69adb3a3cf6e975d3631367199901f74e2c2dcf47dad59c196d75e84296
|
- initial_input_ast: ab2559f6d78ee4c41a3d7e181ee872eca6139dd7f6defa981decc3c7c3173e86
|
||||||
initial_ast: 187f5722d547f273209af43573eea2eeb2122d17f3e4c605524e376d7ad3ed34
|
initial_ast: 3ff12a1a7958a776bff06088d1a0ba38905432828033a8c01391c86525991fea
|
||||||
unrolled_ast: 187f5722d547f273209af43573eea2eeb2122d17f3e4c605524e376d7ad3ed34
|
unrolled_ast: 3ff12a1a7958a776bff06088d1a0ba38905432828033a8c01391c86525991fea
|
||||||
ssa_ast: 382adac57e7d57c423ab97ea3359c0dd07bbd9490a9a28ba071425960c2cefcc
|
ssa_ast: 0ac1e90f36a5bd800865d97fba6d3e4f29d9e06b6a19e18e6791144bb62e54c4
|
||||||
|
@ -3,8 +3,8 @@ namespace: Compile
|
|||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: 6acc632daaf5f0c552f4d80973d19881cf097ff377fab16d5156c11aeb7930ca
|
- initial_input_ast: bf5506bb148ebd276e006d26957cb9d1482319cce03716eae74e4e973c7e3c53
|
||||||
- initial_input_ast: 723023394750964e78349b54a39fb569c861b33205b2b332cc6be525f01d07bd
|
- initial_input_ast: b5f8e0f060ee0428c214f242e56679137c1fb661fedbb792a16207b2e5ea3faf
|
||||||
initial_ast: 6603f57d41a1ce41b0fa57de7b0351e51b42cb551597f27fc4d9e0e5f64f89a7
|
initial_ast: 68f1f488e04f9aa6103077bdf47e3b15160ef82bb7f5b3ea0c2a9ffa5a320c44
|
||||||
unrolled_ast: 6603f57d41a1ce41b0fa57de7b0351e51b42cb551597f27fc4d9e0e5f64f89a7
|
unrolled_ast: 68f1f488e04f9aa6103077bdf47e3b15160ef82bb7f5b3ea0c2a9ffa5a320c44
|
||||||
ssa_ast: ba3ec9b1d28143155c5fe0ab682706263dfdcf0f7a09b8fc4567a43f2ce4e21b
|
ssa_ast: 05e25627a5405914c6114729d68dd966ed75d9f3cbedd646ee5f86995780e190
|
||||||
|
@ -3,7 +3,7 @@ namespace: Compile
|
|||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: 804fee09bda9b498b193d0fbc9654f078fa9fb09fd02f6ffe94d05d71ade52af
|
- initial_input_ast: 42c3ea30914e89eb47ce7d31a96d47f6d1cd364a7fb5cd0d27e49735bae4cc00
|
||||||
initial_ast: 38f1802cc79a6fba93c5ffb3d6361e68cbdb5dd66f7f01e9d6166ba4894e5d29
|
initial_ast: 6ea535384e138485643e9674dbcbf38487b45fb20bc743cedbe5130ca6b61001
|
||||||
unrolled_ast: 38f1802cc79a6fba93c5ffb3d6361e68cbdb5dd66f7f01e9d6166ba4894e5d29
|
unrolled_ast: 6ea535384e138485643e9674dbcbf38487b45fb20bc743cedbe5130ca6b61001
|
||||||
ssa_ast: e786d750aa26fb6399a1311c9afd31d20e56d990a34eb0343cb63b21c257b7e1
|
ssa_ast: ffd3704d8b61bc4b6ba3dd7ce6a51f77718a834e60d296282944355a78c9edda
|
||||||
|
@ -2,4 +2,4 @@
|
|||||||
namespace: Compile
|
namespace: Compile
|
||||||
expectation: Fail
|
expectation: Fail
|
||||||
outputs:
|
outputs:
|
||||||
- "Error [EPAR0370005]: expected -> -- found '{'\n --> compiler-test:3:17\n |\n 3 | function main() {\n | ^"
|
- "Error [ETYC0372008]: The value 32768 is not a valid `i16`\n --> compiler-test:5:20\n |\n 5 | const a: i16 = 32768i16;\n | ^^^^^^^^\n"
|
||||||
|
@ -3,7 +3,7 @@ namespace: Compile
|
|||||||
expectation: Pass
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: 41447babe412945bcb82a83876bfbf13a49da1bd175909bd66def5f983abc0fa
|
- initial_input_ast: 3659f083f005fb393c9ae234061a976d0cb989def72f50688dd09eb6505a5e88
|
||||||
initial_ast: ac2f6713a2372926514109f4800b95a371cb90f374c033872b5f3a72e065cd35
|
initial_ast: 467e605d0d30da8e6e7d93c1e33897bf9ec1c4dfae0e807e0e0c60f45b27b81d
|
||||||
unrolled_ast: ac2f6713a2372926514109f4800b95a371cb90f374c033872b5f3a72e065cd35
|
unrolled_ast: 467e605d0d30da8e6e7d93c1e33897bf9ec1c4dfae0e807e0e0c60f45b27b81d
|
||||||
ssa_ast: c48dbcb655e0324971cc1dcec072fdd2608905a14aaa3df1c772d2ea0491de0b
|
ssa_ast: 5be594db36321078437ffc177621bef2d68981b12c1c7c932431070249dd4155
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
---
|
---
|
||||||
namespace: Compile
|
namespace: Compile
|
||||||
expectation: Fail
|
expectation: Pass
|
||||||
outputs:
|
outputs:
|
||||||
- "Failed to parse string. Parsing Error: VerboseError { errors: [(\"closure main:\\n neg 32767i16 into r0;\\n sub r0 2i16 into r1;\\n output r1 as i16;\\n\\n\\n\", Nom(Tag)), (\"closure main:\\n neg 32767i16 into r0;\\n sub r0 2i16 into r1;\\n output r1 as i16;\\n\\n\\n\", Nom(Alt)), (\"closure main:\\n neg 32767i16 into r0;\\n sub r0 2i16 into r1;\\n output r1 as i16;\\n\\n\\n\", Nom(Many1))] }"
|
- output:
|
||||||
|
- initial_input_ast: 79bcbe7e9238a5693c7767022694c80ac5b120c8a165666d22d3a84b31c1a561
|
||||||
|
initial_ast: 6a89bc09a0fdf663002fbeda1e56a84c1311554c94a5a0b3201cf12b187fbbe7
|
||||||
|
unrolled_ast: 6a89bc09a0fdf663002fbeda1e56a84c1311554c94a5a0b3201cf12b187fbbe7
|
||||||
|
ssa_ast: 3928b45e84ed49128f1252dc11a159ab9a22426706d1f799f2ea02d2f47e22b4
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user