Squashed commit of the following:

commit 7a5979660b
Merge: 695a949c 88bd065d
Author: Alessandro Coglio <acoglio@aleo.org>
Date:   Mon Aug 23 08:50:41 2021 -0700

    Merge pull request #1272 from AleoHQ/feature/call-expressions-ast-store-type

    [Implmentation] Adds Type to Circuit Member Access Expressions

commit 695a949cff
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Mon Aug 23 17:25:19 2021 +0300

    Bump serde from 1.0.127 to 1.0.128 (#1288)

    Bumps [serde](https://github.com/serde-rs/serde) from 1.0.127 to 1.0.128.
    - [Release notes](https://github.com/serde-rs/serde/releases)
    - [Commits](https://github.com/serde-rs/serde/compare/v1.0.127...v1.0.128)

    ---
    updated-dependencies:
    - dependency-name: serde
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...

    Signed-off-by: dependabot[bot] <support@github.com>

    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

commit fd3d7d0624
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Mon Aug 23 17:25:05 2021 +0300

    Bump serde_yaml from 0.8.18 to 0.8.19 (#1289)

    Bumps [serde_yaml](https://github.com/dtolnay/serde-yaml) from 0.8.18 to 0.8.19.
    - [Release notes](https://github.com/dtolnay/serde-yaml/releases)
    - [Commits](https://github.com/dtolnay/serde-yaml/compare/0.8.18...0.8.19)

    ---
    updated-dependencies:
    - dependency-name: serde_yaml
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...

    Signed-off-by: dependabot[bot] <support@github.com>

    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

commit 84e972c9ad
Merge: d609bb28 fbc3dfb4
Author: Alessandro Coglio <acoglio@aleo.org>
Date:   Sat Aug 21 18:44:39 2021 -0700

    Merge pull request #1267 from AleoHQ/bug/implicit-ternary-type-inference

    [Bugfix] Ternary Implicit and Explicit Unkown Type

commit 88bd065d8a
Merge: 56c66fa4 235daa9e
Author: gluaxspeed <jonathan.t.pavlik@gmail.com>
Date:   Wed Aug 18 16:25:23 2021 -0700

    merge master, regen tests

commit fbc3dfb4c9
Merge: 56996f98 235daa9e
Author: gluaxspeed <jonathan.t.pavlik@gmail.com>
Date:   Wed Aug 18 16:14:14 2021 -0700

    merge master, regen tests

commit 56c66fa4ba
Author: gluaxspeed <jonathan.t.pavlik@gmail.com>
Date:   Wed Aug 18 14:31:06 2021 -0700

    testing and clean up

commit a91c8b9e6a
Author: gluaxspeed <jonathan.t.pavlik@gmail.com>
Date:   Wed Aug 18 13:38:50 2021 -0700

    Revert "type on call expression"

    This reverts commit cf5a23b38f.

commit cf5a23b38f
Author: gluaxspeed <jonathan.t.pavlik@gmail.com>
Date:   Wed Aug 18 02:04:41 2021 -0700

    type on call expression

commit 56996f989e
Author: gluaxspeed <jonathan.t.pavlik@gmail.com>
Date:   Wed Aug 18 01:09:45 2021 -0700

    fix ternary bug
This commit is contained in:
damirka 2021-08-24 22:21:40 +03:00
parent e0c2f6470f
commit dfa15b1a4f
49 changed files with 199 additions and 106 deletions

14
Cargo.lock generated
View File

@ -2361,9 +2361,9 @@ dependencies = [
[[package]]
name = "serde"
version = "1.0.127"
version = "1.0.128"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f03b9878abf6d14e6779d3f24f07b2cfa90352cfec4acc5aab8f1ac7f146fae8"
checksum = "1056a0db1978e9dbf0f6e4fca677f6f9143dc1c19de346f22cac23e422196834"
dependencies = [
"serde_derive",
]
@ -2380,9 +2380,9 @@ dependencies = [
[[package]]
name = "serde_derive"
version = "1.0.127"
version = "1.0.128"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a024926d3432516606328597e0f224a51355a493b49fdd67e9209187cbe55ecc"
checksum = "13af2fbb8b60a8950d6c72a56d2095c28870367cc8e10c55e9745bac4995a2c4"
dependencies = [
"proc-macro2 1.0.27",
"quote 1.0.9",
@ -2414,12 +2414,12 @@ dependencies = [
[[package]]
name = "serde_yaml"
version = "0.8.18"
version = "0.8.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "039ba818c784248423789eec090aab9fb566c7b94d6ebbfa1814a9fd52c8afb2"
checksum = "6375dbd828ed6964c3748e4ef6d18e7a175d408ffe184bca01698d0c73f915a9"
dependencies = [
"dtoa",
"linked-hash-map",
"indexmap",
"serde",
"yaml-rust",
]

View File

@ -91,6 +91,7 @@ impl<'a> FromAst<'a, leo_ast::CallExpression> for CallExpression<'a> {
circuit: ast_circuit,
name,
span,
..
}) => {
let target = <&Expression<'a>>::from_ast(scope, &**ast_circuit, None)?;
let circuit = match target.get_type() {

View File

@ -203,6 +203,7 @@ impl<'a> Into<leo_ast::Expression> for &CircuitAccessExpression<'a> {
circuit: Box::new(target.into()),
name: self.member.clone(),
span: self.span.clone().unwrap_or_default(),
type_: None,
})
} else {
leo_ast::Expression::CircuitStaticFunctionAccess(leo_ast::CircuitStaticFunctionAccessExpression {

View File

@ -87,7 +87,15 @@ impl<'a> FromAst<'a, leo_ast::TernaryExpression> for TernaryExpression<'a> {
)?);
let left: PartialType = if_true.get().get_type().unwrap().into();
let if_false = Cell::new(<&Expression<'a>>::from_ast(scope, &*value.if_false, expected_type)?);
let if_false = if expected_type.is_none() {
Cell::new(<&Expression<'a>>::from_ast(
scope,
&*value.if_false,
Some(left.clone()),
)?)
} else {
Cell::new(<&Expression<'a>>::from_ast(scope, &*value.if_false, expected_type)?)
};
let right = if_false.get().get_type().unwrap().into();
if left != right {

View File

@ -95,7 +95,7 @@ impl<'a> FromAst<'a, leo_ast::Statement> for &'a Statement<'a> {
scope, statement, None,
)?))
}
Iteration(statement) => Self::from_ast(scope, &**statement, None)?,
Iteration(ref statement) => Self::from_ast(scope, &**statement, None)?,
Console(statement) => scope
.context
.alloc_statement(Statement::Console(ConsoleStatement::from_ast(scope, statement, None)?)),

View File

@ -21,6 +21,7 @@ pub struct CircuitMemberAccessExpression {
pub circuit: Box<Expression>,
pub name: Identifier,
pub span: Span,
pub type_: Option<crate::Type>,
}
impl fmt::Display for CircuitMemberAccessExpression {

View File

@ -76,6 +76,7 @@ impl Canonicalizer {
circuit: left,
name: identifier,
span: span.clone(),
type_: None,
}));
}
}
@ -270,6 +271,7 @@ impl Canonicalizer {
circuit: Box::new(self.canonicalize_expression(&circuit_member_access.circuit)),
name: circuit_member_access.name.clone(),
span: circuit_member_access.span.clone(),
type_: None,
});
}
Expression::CircuitStaticFunctionAccess(circuit_static_func_access) => {

View File

@ -241,9 +241,14 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
) -> Result<CircuitMemberAccessExpression> {
let circuit = self.reduce_expression(&circuit_member_access.circuit)?;
let name = self.reduce_identifier(&circuit_member_access.name)?;
let type_ = circuit_member_access
.type_
.as_ref()
.map(|type_| self.reduce_type(type_, &circuit_member_access.span))
.transpose()?;
self.reducer
.reduce_circuit_member_access(circuit_member_access, circuit, name)
.reduce_circuit_member_access(circuit_member_access, circuit, name, type_)
}
pub fn reduce_circuit_static_fn_access(

View File

@ -215,11 +215,13 @@ pub trait ReconstructingReducer {
circuit_member_access: &CircuitMemberAccessExpression,
circuit: Expression,
name: Identifier,
type_: Option<Type>,
) -> Result<CircuitMemberAccessExpression> {
Ok(CircuitMemberAccessExpression {
circuit: Box::new(circuit),
name,
span: circuit_member_access.span.clone(),
type_,
})
}

View File

@ -225,17 +225,31 @@ impl<R: ReconstructingReducer, O: CombinerOptions> CombineAstAsgDirector<R, O> {
}
pub fn reduce_call(&mut self, ast: &AstCallExpression, asg: &AsgCallExpression) -> Result<AstCallExpression> {
// TODO FIGURE IT OUT
// let function = self.reduce_expression(&ast.function, asg.function.get())?;
// let target = asg.target.get().map(|exp| self.reduce_expression())
// Is this needed?
let mut function = *ast.function.clone();
if self.options.type_inference_enabled() {
let function_type: Option<leo_ast::Type> = asg
.target
.get()
.map(|target| {
(target as &dyn leo_asg::ExpressionNode)
.get_type()
.as_ref()
.map(|t| t.into())
})
.flatten();
if let AstExpression::CircuitMemberAccess(mut access) = function {
access.type_ = function_type;
function = AstExpression::CircuitMemberAccess(access);
}
}
let mut arguments = vec![];
for (ast_arg, asg_arg) in ast.arguments.iter().zip(asg.arguments.iter()) {
arguments.push(self.reduce_expression(ast_arg, asg_arg.get())?);
}
self.ast_reducer.reduce_call(ast, *ast.function.clone(), arguments)
self.ast_reducer.reduce_call(ast, function, arguments)
}
pub fn reduce_cast(&mut self, ast: &AstCastExpression, asg: &AsgCastExpression) -> Result<AstCastExpression> {
@ -248,14 +262,19 @@ impl<R: ReconstructingReducer, O: CombinerOptions> CombineAstAsgDirector<R, O> {
pub fn reduce_circuit_member_access(
&mut self,
ast: &CircuitMemberAccessExpression,
_asg: &AsgCircuitAccessExpression,
asg: &AsgCircuitAccessExpression,
) -> Result<CircuitMemberAccessExpression> {
// let circuit = self.reduce_expression(&circuit_member_access.circuit)?;
// let name = self.reduce_identifier(&circuit_member_access.name)?;
// let target = input.target.get().map(|e| self.reduce_expression(e));
let type_ = if self.options.type_inference_enabled() {
Some(leo_ast::Type::Circuit(asg.circuit.get().name.borrow().clone()))
} else {
None
};
self.ast_reducer
.reduce_circuit_member_access(ast, *ast.circuit.clone(), ast.name.clone())
.reduce_circuit_member_access(ast, *ast.circuit.clone(), ast.name.clone(), type_)
}
pub fn reduce_circuit_static_fn_access(

View File

@ -41,7 +41,7 @@ version = "0.3.61"
version = "2.0"
[dependencies.serde]
version = "1.0.126"
version = "1.0.128"
features = [ "derive", "rc" ]
[dependencies.tendril]

View File

@ -452,6 +452,7 @@ impl ParserContext {
span: expr.span() + &ident.span,
circuit: Box::new(expr),
name: ident,
type_: None,
});
} else if let Some((num, span)) = self.eat_int() {
expr = Expression::TupleAccess(TupleAccessExpression {

View File

@ -0,0 +1,6 @@
[main]
x: u8 = 3;
y: bool = true;
[registers]
a: u8 = 0;

View File

@ -0,0 +1,9 @@
/*
namespace: Compile
expectation: Pass
input_file: inputs/ternary_explicit_and_implicit.in
*/
function main(x: u8, y: bool) -> u8 {
return y ? x : 2;
}

View File

@ -16,6 +16,6 @@ outputs:
out:
type: bool
value: "true"
initial_ast: 589670c04ad13f8dbe2ea01562fa6bdff1c6dfaf118730e60d0a55e5bb2168b9
canonicalized_ast: 82fd732401abaced235b6522298a454fd0491ea1dc0a80170773e1a129320657
type_inferenced_ast: 14321d2bd1a2d9da60f52372feee4c8bf6aa98d516c01bf309d219c903b7f241
initial_ast: 9a4630fa0959a626a26800f00d05a203e35f4389a9d17a6dc491eb725ef3a529
canonicalized_ast: 6c7df16234b6b4d8aaa6ca1d761bcffb5b05893cc515b6f4d72118bc8e495b7e
type_inferenced_ast: 4aa60801f15fb817e16eb9f9bd4d6bed555c9130d88edebb3ba78302879703a1

View File

@ -22,6 +22,6 @@ outputs:
r:
type: "[u8; 3]"
value: "\"123\""
initial_ast: c6b18b6fca7fda77a9eba151f4d27d084e1ad7aa616e6ec9deb1ef5f4bff2d24
canonicalized_ast: c6b18b6fca7fda77a9eba151f4d27d084e1ad7aa616e6ec9deb1ef5f4bff2d24
type_inferenced_ast: 6f6e6b35b55543bc87589005ac9a47830e3f65680a4db82e3f17d9280d6fa4ad
initial_ast: 1c07965336635dce8cd66c67eddf25a51f61a3b90513f87ef123c642a9b5b18a
canonicalized_ast: 1c07965336635dce8cd66c67eddf25a51f61a3b90513f87ef123c642a9b5b18a
type_inferenced_ast: cf35fa9ca18f19ac75ca522a77e310b02ff56ac1d748cd5df5c2204bba4a4802

View File

@ -100,6 +100,6 @@ outputs:
r:
type: char
value: "'\\u{1f62d}'"
initial_ast: aa3eb0c4de0eebada9490b11e35c36923316559727a3afce28fe3852a805354a
canonicalized_ast: aa3eb0c4de0eebada9490b11e35c36923316559727a3afce28fe3852a805354a
type_inferenced_ast: 73309200d30bf2831847477f3da7ede4ba9f4aa377e6ebf15c9c34774f53bcb5
initial_ast: 715a33d0032f02d69d13687ac98005a789b6bcb63ff619865b21f0c691f14a75
canonicalized_ast: 715a33d0032f02d69d13687ac98005a789b6bcb63ff619865b21f0c691f14a75
type_inferenced_ast: d04164068277e88b5529f1072b512ffadc7eaaf704c8a3e394a409e783cc1e27

View File

@ -16,6 +16,6 @@ outputs:
r0:
type: bool
value: "true"
initial_ast: 776ea4bb946bb5d56430c22be58f3539dbecb25a11ec07e5e8bd3db49be7f937
canonicalized_ast: 6a95acbcb25193b7b9f9e7a2bbcaeafa83ec09163e097b12076ea512a9daaf14
type_inferenced_ast: d71ab34660bf998f236dfe59e55050f9f5fba8671bacbbdde04b4902927ec571
initial_ast: bc330763338677f23601b03f5665bd8f42f8143f59cc9b4803fb693b3cfa0311
canonicalized_ast: fbff610ef772ee7f997b4bc4cd7c2a3f2024d70af35b94a966ca6a0f19f15194
type_inferenced_ast: f6b0159f6bffeff8e3cde7f13c97ac5d537b40855271a4a13d07a84d24d78504

View File

@ -16,6 +16,6 @@ outputs:
r0:
type: bool
value: "true"
initial_ast: b438fb664bd7b8683beabd5044efba7669d3fcab093994b1c386a30ad63fff14
canonicalized_ast: b438fb664bd7b8683beabd5044efba7669d3fcab093994b1c386a30ad63fff14
type_inferenced_ast: 9094424be690a804ae2e5d3ca2787104de01dc6bca89fe6d349db5709c5161ac
initial_ast: 601fb882472ee0ff4aea3330822936a9df64bfc8ceefcd83f000bb3094878d47
canonicalized_ast: 601fb882472ee0ff4aea3330822936a9df64bfc8ceefcd83f000bb3094878d47
type_inferenced_ast: 110a4e51c4c0ace6c0f3aa385e1735cb4ecf3cfea2a9d2ab7591da3826582c31

View File

@ -16,6 +16,6 @@ outputs:
r0:
type: bool
value: "true"
initial_ast: 7221141253b1998cbddad5f0c1385e7b53450a535112c0eb112b5af01474ce20
canonicalized_ast: 7221141253b1998cbddad5f0c1385e7b53450a535112c0eb112b5af01474ce20
type_inferenced_ast: f208046c46de9c4a42c47079504791711c9b0c8b3fb35dd413243fcbfd7dbd90
initial_ast: 63f34a3b537f3221e8711828f7d0953c0766627c0cdb2e37933b88a93550e261
canonicalized_ast: 63f34a3b537f3221e8711828f7d0953c0766627c0cdb2e37933b88a93550e261
type_inferenced_ast: 29604fd57ee8658f83e552bc6496541ebcebb91afa313a1706b285fe18385c4c

View File

@ -16,6 +16,6 @@ outputs:
r0:
type: u32
value: "100"
initial_ast: ba821e922e3b934581e39a58e2ef08d14b6cb0355500ed79f017dc0ecd39651c
canonicalized_ast: ba821e922e3b934581e39a58e2ef08d14b6cb0355500ed79f017dc0ecd39651c
type_inferenced_ast: 03fadaa1772f83ffa18a67a2279a65bad0715a6077f7219ff8955b45707c0437
initial_ast: c76bd461573b9bb3622a74b5c5a10a98402b8c86c13086c01c161b77aac0c642
canonicalized_ast: c76bd461573b9bb3622a74b5c5a10a98402b8c86c13086c01c161b77aac0c642
type_inferenced_ast: 213f747571838133c62a73574f769d25fd42afce151e580be42d1d9d7b62033b

View File

@ -16,6 +16,6 @@ outputs:
r0:
type: bool
value: "true"
initial_ast: 58d028cbd020f04ef3b1025a07dabbc8bc4f5a2adf7e2ca4bb67cc229d4f64cd
canonicalized_ast: 5e72d67df40e8ecd2ae9999419888ade6ebf1c054f1f80f91a274360e294d361
type_inferenced_ast: 177f3be4bed2ca8e1a9543b8bb71a75a751d6835dcac15910bc4bd5fa9e25897
initial_ast: 3b07cdd6e203ad5775a6c75a4598330e4bf7b04616bdbd532df20bd7bba1981d
canonicalized_ast: f87f269c06e5eb1d6802b4a92c9a4af2a3966583dbaa2454b5468b3f56114a15
type_inferenced_ast: 73ed7092d40d9b7e5be744e14da191eaa7f0758b6027c7e984365bd33e07ae2d

View File

@ -16,6 +16,6 @@ outputs:
r0:
type: bool
value: "true"
initial_ast: 681bcdc031155971ce0dab8c8ee659df3f09b97b4e6b4525d47f4a045765a57c
canonicalized_ast: 681bcdc031155971ce0dab8c8ee659df3f09b97b4e6b4525d47f4a045765a57c
type_inferenced_ast: 40920da878d0316ea8fd4d1963e53843b1d8933441fd568adba5f11e4ded7246
initial_ast: b53c2c321c3f6ee2202eaca1e709607f5e82f9e456be132b08493de57b1c4089
canonicalized_ast: b53c2c321c3f6ee2202eaca1e709607f5e82f9e456be132b08493de57b1c4089
type_inferenced_ast: a94dfe431aa43189323427aadb33120d4ac03e19b9a898353858c26b624869ed

View File

@ -16,6 +16,6 @@ outputs:
r0:
type: bool
value: "true"
initial_ast: 05ea77fc193abe91954fc2fcd338d3ebfaff6bb7939339e9dcc78e514802dd42
canonicalized_ast: 05ea77fc193abe91954fc2fcd338d3ebfaff6bb7939339e9dcc78e514802dd42
type_inferenced_ast: 9827f4b622a95714f55620295e8ce9d9cf6fc85603a869b178825c818d64d768
initial_ast: 8b7192c1472be002b294589105832ae0e979e964fc62e63ba22b1f0cf3b762e5
canonicalized_ast: 8b7192c1472be002b294589105832ae0e979e964fc62e63ba22b1f0cf3b762e5
type_inferenced_ast: 14d9f0f0a222b6ec4236b0eb75e0740d624279181bb7ab9281752529b0a0f417

View File

@ -16,6 +16,6 @@ outputs:
r0:
type: bool
value: "true"
initial_ast: 0723285d6c4dac924f6c86e0a6fd57eb78947cfcecd45f2520b7b0f0029f3279
canonicalized_ast: 0723285d6c4dac924f6c86e0a6fd57eb78947cfcecd45f2520b7b0f0029f3279
type_inferenced_ast: c42738de8987ca76cacc30dbf86688ff11d5dbf7dccba67947cc78eb452460fd
initial_ast: 7abdf292d56f99ef05e39c1a55a6071d9d69ca8c8e537e08201472f057e7a127
canonicalized_ast: 7abdf292d56f99ef05e39c1a55a6071d9d69ca8c8e537e08201472f057e7a127
type_inferenced_ast: db8685abd4ffc32fa55786b847eff1d0694b871c1757eec70757879d82856872

View File

@ -16,6 +16,6 @@ outputs:
r0:
type: bool
value: "true"
initial_ast: bbad7fd765dee42c9ebaca7e07201d61befefa5e7d5af700130954ac29cdd27c
canonicalized_ast: bbad7fd765dee42c9ebaca7e07201d61befefa5e7d5af700130954ac29cdd27c
type_inferenced_ast: cb8745ad419c19ad007a9d9d905f01c0d85d2e78cb82be0b82342c44015c322e
initial_ast: ca98bec50adc76ce348e28e7020d6e99cb6aa8fb733e0e0bce023ca8d1e3e4b6
canonicalized_ast: ca98bec50adc76ce348e28e7020d6e99cb6aa8fb733e0e0bce023ca8d1e3e4b6
type_inferenced_ast: ec5aad932c3d0d016142a7d288328547949da8add55025076c5d404d2451917d

View File

@ -16,6 +16,6 @@ outputs:
r0:
type: bool
value: "true"
initial_ast: d2d5680f0e011b93b2e55aebb62f51b4e78cf68289ffd84a80f852d2a82a6723
canonicalized_ast: 57c2e52b3f73e7052fdc92d0c668b598b282321cd390ed836f20b92bc528b6e0
type_inferenced_ast: 4f8c32d94398d49ffb9b1eab3639076e77d77159411c1891d814b4946751e554
initial_ast: a9313db75382b5afb38e9453bdb0dd6c0aa7368cf11e208eb0ca8124ea615d8b
canonicalized_ast: 3d4bb330e687601978d3f68544582d93c3bace6c0d3e8808c409b8534c563403
type_inferenced_ast: 14b0aa9c6d83ca85c625cdc78e4cf96dcbe1672b98c379e8783744d59d699bb1

View File

@ -16,6 +16,6 @@ outputs:
r0:
type: bool
value: "true"
initial_ast: 15da2283babf7f4a490bd7bdc0331522107f7ce4c88949863178ba4a00419ead
canonicalized_ast: 96a167f8b897e9973bb7b9d13faa81da0b635a6611ef09124a5d12f817b35254
type_inferenced_ast: 82c54a8e54820fc234a7029cb4c6018df99e7a3d4b47f418efc8835889b1c6cc
initial_ast: ff029cd4035cb046857e7e8c0ff56c843969d2f04db76ced2698a20cf0491485
canonicalized_ast: 88447a6c1f7b92f4af7d9cecd7fd8d6fa5e96ed5dd6c6fde5897cf3df3f5cbc5
type_inferenced_ast: 51a081de631b9b95b2055ea5ba6a52d17972caf8bf7c70dadd49801af9d011f9

View File

@ -16,6 +16,6 @@ outputs:
r0:
type: bool
value: "true"
initial_ast: 6fd3b11431e3e71f2b628bc9c64cb51d04c77df08d7584503b76b3dff7bc90cc
canonicalized_ast: a7a942a8a40f7cf8bfd79fdea0ed81fb6b56cfd9009b01b3d0225b427ef583cd
type_inferenced_ast: d3cc0e19adac957e11d520bf727133bfcc85eef5f306373cb5057b840b1a41f6
initial_ast: 5d815c98c76a76dd93051902eae718df3db66e0268ba9af8ae62ef7af19b1d48
canonicalized_ast: 798961ad9da5a767a98882ff36944483f1f1412dcf10f67acf1f390a19bfc138
type_inferenced_ast: 6dbfd429fa50f0017a01dae57ae2a98e7452ab7c54bfcd251e1ed40e5f28176c

View File

@ -16,6 +16,6 @@ outputs:
r0:
type: bool
value: "true"
initial_ast: 48713617e0f06ade7b443ec779e646b0ff82e025f040c8a28bf2ea7eb37f3399
canonicalized_ast: 48713617e0f06ade7b443ec779e646b0ff82e025f040c8a28bf2ea7eb37f3399
type_inferenced_ast: 68e4f8baf01d452f42d0765f2819783adb55000238d5d57304a314fb5cff3c22
initial_ast: 357f19fd5e1fbbbeec8a18bcf14c30a7504feacbc88ffbd26e78eedf1d593275
canonicalized_ast: 357f19fd5e1fbbbeec8a18bcf14c30a7504feacbc88ffbd26e78eedf1d593275
type_inferenced_ast: aa3bf1734030119bb595a42d268b30509506ee06cf413b14bcde4e9056679dac

View File

@ -16,6 +16,6 @@ outputs:
r0:
type: bool
value: "true"
initial_ast: 2f6262df5e4a39a662b85cff0985d297fa2628d56fc3c036b5beb31d683a8574
canonicalized_ast: 4bb2ac425c192058af2f97684019d74959bc40abc0f886a741894a89cc8e8d4f
type_inferenced_ast: 6c3c3d16ba595ab33902ece671d2460c3a25347e1e33e35ec82ff8622926afd2
initial_ast: bb1ea12ac46ffd912b45b6febd71de41691c9aa064d07d5492e31845e72d00f2
canonicalized_ast: ad957837a54fca62c6da8665a04dbf57cb87b5c5a000038a1b900c2be359a178
type_inferenced_ast: 0fe1f5ac625424734a5140253228e3a6cde9f548b6deb18907f3ac49871180cc

View File

@ -16,6 +16,6 @@ outputs:
r0:
type: bool
value: "true"
initial_ast: 591aa0cc25f8c009c7df6425697003904e97e74c55f887c5ed3b27984fda4176
canonicalized_ast: 7232353691a314166deb747de9046b05e507b581d35132479b01c6db41e72df6
type_inferenced_ast: ae5cb090082e845a9a058a15de6345a672864bf2ad2061930922475cc2c3f8e1
initial_ast: 41a569090cff5eba31d9640b3f9e8d8585dfcd817d25a42a48edcd2d522fbb72
canonicalized_ast: 5150d7b2463ec10096f925fde523a4b956093ca44579487a82f15554fd7c32ed
type_inferenced_ast: 71d1f128ff9c4fa1df5189139360f4ccb3a460e83034c635952e6875c7fe41bb

View File

@ -16,6 +16,6 @@ outputs:
r0:
type: bool
value: "true"
initial_ast: 6b54a642c55d3a7991a063c5346797a4d7facf21533c8ec7b2e22eb9394caba0
canonicalized_ast: 6b54a642c55d3a7991a063c5346797a4d7facf21533c8ec7b2e22eb9394caba0
type_inferenced_ast: 5b4b8ea9431aca05e19fcf8987c4f4c824c065e2ed6fc7198cd769b8829ee4f1
initial_ast: 5627039d5f3151255d4c7fff31fa548febc788fe2717606a4814a91937fee405
canonicalized_ast: 5627039d5f3151255d4c7fff31fa548febc788fe2717606a4814a91937fee405
type_inferenced_ast: 88e398f6f173de48fb7a6109fe886fd59b2fae70d1b9ccc53fd447d9b46ad0a3

View File

@ -19,6 +19,6 @@ outputs:
r1:
type: bool
value: "true"
initial_ast: f982480cc10a58594b1ed75be2d2dcd29ed874fa666497f2c14b58c338a4443f
canonicalized_ast: f982480cc10a58594b1ed75be2d2dcd29ed874fa666497f2c14b58c338a4443f
type_inferenced_ast: f70e1d694f99f56777ac863e764615c6bc496ebb4f476c2faf8356e9246f4d24
initial_ast: db801c467c6e6bd413b951d6a8f95e841e0254a3f00a3e1ff903ab2dcd63b253
canonicalized_ast: db801c467c6e6bd413b951d6a8f95e841e0254a3f00a3e1ff903ab2dcd63b253
type_inferenced_ast: 575c9b880a4a061bce5ace598d6d4195ca0f41278afc2b1a950c74052b2b9cef

View File

@ -16,6 +16,6 @@ outputs:
r0:
type: bool
value: "false"
initial_ast: 97024a9c26e890afe8f4dc64b727a72e837f46b27ff56cddc1231c29671dc2b4
canonicalized_ast: 8674af05f953dfda5eb360e367447912e9d0ec5abf513eaba14444bd66bd9cae
type_inferenced_ast: 33017f3824095dcb4431f73db16a3fe1e845d30d7a6366182b247a23445eb26d
initial_ast: d8d093539faee853421ce529aec6b222a651c494ca9f2a6eb4faafc443bbc02d
canonicalized_ast: 0556a49c8e1ef663c4428d9c5c315dcfa0721a000d0d482bc10f9c164ef1a4de
type_inferenced_ast: bb15e2202bb322be9f823823c780b5771854cebc311f107d51a88d0e601fa41e

View File

@ -16,6 +16,6 @@ outputs:
b:
type: bool
value: "true"
initial_ast: 2cfed669110dc972ec11a67149117c6dd2f4d09d7791d7d3cdfe334c32bfc3eb
canonicalized_ast: 2cfed669110dc972ec11a67149117c6dd2f4d09d7791d7d3cdfe334c32bfc3eb
type_inferenced_ast: 4df0dad517cafd4f8f4e9a9717e0b4d3decd2c07091338cd65fe97fdcc5e8778
initial_ast: 2e0d03e2ad668ec5149102d0f9de870d0b3d263fb5c460471db913b5c15e153b
canonicalized_ast: 2e0d03e2ad668ec5149102d0f9de870d0b3d263fb5c460471db913b5c15e153b
type_inferenced_ast: ab37500c6660ca13113fe642160046179b9713d848ab712cd1c57b6e82ac7916

View File

@ -16,6 +16,6 @@ outputs:
r0:
type: bool
value: "true"
initial_ast: 2a87c1d20941f840d6e6535b0145568e8aea7f87466c5e313329e3844efeef82
canonicalized_ast: 2a87c1d20941f840d6e6535b0145568e8aea7f87466c5e313329e3844efeef82
type_inferenced_ast: 34a0270bb47f0ba1b72f8789a1223084b6719933dd937f6703759502ace7a346
initial_ast: 7c42b985a3e0013f38398639442535e6f40af6f379d9af65387e707cd97fb146
canonicalized_ast: 7c42b985a3e0013f38398639442535e6f40af6f379d9af65387e707cd97fb146
type_inferenced_ast: aeb12c856d7aa61002723056fc228fa4d342076b7c2bac597269f426a29a4cb2

View File

@ -16,6 +16,6 @@ outputs:
r0:
type: bool
value: "true"
initial_ast: 6fd4f46e0a795fd0edef840925c6a152c8b69685f30b42b1dc5aeaf2e0f1296a
canonicalized_ast: 6fd4f46e0a795fd0edef840925c6a152c8b69685f30b42b1dc5aeaf2e0f1296a
type_inferenced_ast: ad948d43d662198b33e752ac1c20807b5d79525c4cc61f15d41155f31ade71c4
initial_ast: 9cca50f35319c4b4e776c170a2936cb7e0a82c2d458bd725a282f1eaa3f01391
canonicalized_ast: 9cca50f35319c4b4e776c170a2936cb7e0a82c2d458bd725a282f1eaa3f01391
type_inferenced_ast: d75b58e775d20e72834683792cbf09339bb9f07ce05501d0331026cc0fe859cf

View File

@ -16,6 +16,6 @@ outputs:
r0:
type: bool
value: "true"
initial_ast: 14d707805bc7e51b4b01dc9272ce7e7f1018c52a885a14177acb4e7ca34174f5
canonicalized_ast: 14d707805bc7e51b4b01dc9272ce7e7f1018c52a885a14177acb4e7ca34174f5
type_inferenced_ast: b399e663877ab10bb59844997e4a6a94e53c67cec20112a125906087a91f3a32
initial_ast: 21381595616fc58e28df26f9c89b4cddcd8219703cd877523c55c80617288e07
canonicalized_ast: 21381595616fc58e28df26f9c89b4cddcd8219703cd877523c55c80617288e07
type_inferenced_ast: 981b4059bbf5feaa39719dfd802585fca3ee841c3e78792eb7b68470a015a41a

View File

@ -16,6 +16,6 @@ outputs:
r0:
type: bool
value: "true"
initial_ast: afde0187f805e33f804917815a52421a2662aa029b182be76c39f4ce5f3f453a
canonicalized_ast: 9dfd8d93fa20899e9d146d65b2564f1275cfb73158d8d96ed09f7157ff327e39
type_inferenced_ast: e59a2cba730871aba6258b78f469b9df7763f8d78ad6bbda5c6026a989bc3d88
initial_ast: f98b76f43ddfdf48c6ae59d240f8cc5435af4af4d858b42a215b6c7cdc62cbe0
canonicalized_ast: 9322ad9c85e77f9491596f2edf8fbe28e1843e79467a26c700adc1674362cc81
type_inferenced_ast: f1ca7540ea64649a3b8fa23be49593b001eb6b46be162701481d2bad4b2fea09

View File

@ -16,6 +16,6 @@ outputs:
r0:
type: bool
value: "true"
initial_ast: db9400fc979f1cfd8eea30945594b0e8d2f4138bb32021b9086021b492e2e246
canonicalized_ast: db9400fc979f1cfd8eea30945594b0e8d2f4138bb32021b9086021b492e2e246
type_inferenced_ast: 24783ef52315a02bb2f2e34f5a4020f09f4573ae6d182cab699bf45235e1c4a3
initial_ast: 1341a7e36aa9a9d76d032b4245ac4cecf8c62938cd921be44fc13a736cd21daf
canonicalized_ast: 1341a7e36aa9a9d76d032b4245ac4cecf8c62938cd921be44fc13a736cd21daf
type_inferenced_ast: 3e10385fa57b142f27bf8b9d9141ca83fece80755ac4643743f9db3824817750

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- "Error [EASG0373021]: ternary sides had different types: left u32, right bool\n --> compiler-test:4:13\n |\n 4 | let x = true ? x: true;\n | ^^^^^^^^^^^^^^"
- "Error [EASG0373026]: unexpected type, expected: 'u32', received: 'bool'\n --> compiler-test:4:23\n |\n 4 | let x = true ? x: true;\n | ^^^^"

View File

@ -16,6 +16,6 @@ outputs:
r0:
type: bool
value: "true"
initial_ast: b260517dc70a401c68acfc09bd6434b55b61446e27bd940ad339987eb22ff85e
canonicalized_ast: eb5f37501878e5f97180a6f289f29795e09cb2da6fb031ed7ccb83681b407123
type_inferenced_ast: 3abe1f8136d17844e2d11db603945fc06365cf91b51b9df0a2f700be94df8766
initial_ast: 39a18b43d3d5a65507b9a4bc6558efe27509fa16006de6a98a47c67b6085667c
canonicalized_ast: 25c0175f87357fe5a14e48159c69eb636bfd6836706203d0a30dfbd0ccf9fff3
type_inferenced_ast: ef74c4307c4124ce11ed81e98e0cc555a306c94505d7e40025e66655dac155a8

View File

@ -0,0 +1,21 @@
---
namespace: Compile
expectation: Pass
outputs:
- circuit:
num_public_variables: 0
num_private_variables: 25
num_constraints: 33
at: 00318b0f80b01b9e2d5a8154a536deb1545f04abd493a84071ef13dce1a9d92d
bt: 799ee4dc07f6320b8c3dcbd5ebdf6de8a4cf5af8b1edc45dbe5621c8a34fa38d
ct: 7b6ec9eacd65cfa47dfe7e73eb7c8fa4be804a9fb878fddf59fe5d06e7c04489
output:
- input_file: inputs/ternary_explicit_and_implicit.in
output:
registers:
a:
type: u8
value: "3"
initial_ast: 29b5d6188c9fe56eaee3024a900b92e4bd9445364551b85e924fe9a392bac35d
canonicalized_ast: 29b5d6188c9fe56eaee3024a900b92e4bd9445364551b85e924fe9a392bac35d
type_inferenced_ast: 02edde30e615a1ac3e87818daa6fca7e4d7c0c0c0a1a9d9159a0a4190c11ec8a

View File

@ -16,6 +16,6 @@ outputs:
out:
type: "[char; 13]"
value: "\"Hello, World!\""
initial_ast: 3ece39236ca03d9f6e4a89ae1a5f27cdbc8036eb1485913a2043d1e0a44beb3c
canonicalized_ast: b3df972e5b9658b6addba6f82e972043620a591f5981ac009b56fb6965742695
type_inferenced_ast: 22fdc2ba01f04dbe8140df231d6f8c77ad4b5e62a12dfb45a67686830ebee455
initial_ast: 70c3f622477262389299233a81c02174f0af3c99eb9aea42c2be73f191f44673
canonicalized_ast: e8a3e9c427681a58127b088b0053cbc2f80c859a7081636fceb59dd0cc6cfee7
type_inferenced_ast: db96adeedf84f21908b53bd7db4c4941396afc5fe592012109069186fa066b1a

View File

@ -280,6 +280,7 @@ outputs:
col_stop: 6
path: ""
content: "x[x.y..]"
type_: ~
right: ~
span:
line_start: 1
@ -304,6 +305,7 @@ outputs:
col_stop: 8
path: ""
content: "x[..y.x]"
type_: ~
span:
line_start: 1
line_stop: 1
@ -326,6 +328,7 @@ outputs:
col_stop: 6
path: ""
content: "x[x.y..y.x]"
type_: ~
right:
CircuitMemberAccess:
circuit:
@ -338,6 +341,7 @@ outputs:
col_stop: 11
path: ""
content: "x[x.y..y.x]"
type_: ~
span:
line_start: 1
line_stop: 1
@ -362,6 +366,7 @@ outputs:
col_stop: 6
path: ""
content: "x[x.y.x..y.x.y]"
type_: ~
name: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[x.y.x..y.x.y]\\\"}\"}"
span:
line_start: 1
@ -370,6 +375,7 @@ outputs:
col_stop: 8
path: ""
content: "x[x.y.x..y.x.y]"
type_: ~
right:
CircuitMemberAccess:
circuit:
@ -384,6 +390,7 @@ outputs:
col_stop: 13
path: ""
content: "x[x.y.x..y.x.y]"
type_: ~
name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[x.y.x..y.x.y]\\\"}\"}"
span:
line_start: 1
@ -392,6 +399,7 @@ outputs:
col_stop: 15
path: ""
content: "x[x.y.x..y.x.y]"
type_: ~
span:
line_start: 1
line_stop: 1

View File

@ -13,6 +13,7 @@ outputs:
col_stop: 4
path: ""
content: x.y
type_: ~
- CircuitMemberAccess:
circuit:
Identifier: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"X.Y\\\"}\"}"
@ -24,6 +25,7 @@ outputs:
col_stop: 4
path: ""
content: X.Y
type_: ~
- CircuitMemberAccess:
circuit:
CircuitMemberAccess:
@ -37,6 +39,7 @@ outputs:
col_stop: 4
path: ""
content: x.y.z
type_: ~
name: "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y.z\\\"}\"}"
span:
line_start: 1
@ -45,6 +48,7 @@ outputs:
col_stop: 6
path: ""
content: x.y.z
type_: ~
- Call:
function:
CircuitMemberAccess:
@ -58,6 +62,7 @@ outputs:
col_stop: 4
path: ""
content: x.y()
type_: ~
arguments: []
span:
line_start: 1
@ -79,6 +84,7 @@ outputs:
col_stop: 4
path: ""
content: x.y.0
type_: ~
index:
value: "0"
span:
@ -101,6 +107,7 @@ outputs:
col_stop: 4
path: ""
content: "x.y[1]"
type_: ~
index:
Value:
Implicit:

View File

@ -26,6 +26,7 @@ outputs:
col_stop: 5
path: ""
content: "-x.y"
type_: ~
op: Negate
span:
line_start: 1

View File

@ -26,6 +26,7 @@ outputs:
col_stop: 5
path: ""
content: "!x.y"
type_: ~
op: Not
span:
line_start: 1