mirror of
https://github.com/AleoHQ/leo.git
synced 2024-12-19 07:32:26 +03:00
Merge pull request #1334 from AleoHQ/bug/Self-in-tuple-or-list-arg-errors
[Bugfix] proper canoncialization of function inputs
This commit is contained in:
commit
9af730e8ee
@ -470,15 +470,15 @@ impl Canonicalizer {
|
||||
|
||||
fn canonicalize_function_input(&mut self, input: &FunctionInput) -> FunctionInput {
|
||||
if let FunctionInput::Variable(variable) = input {
|
||||
if variable.type_.is_self() {
|
||||
return FunctionInput::Variable(FunctionInputVariable {
|
||||
identifier: variable.identifier.clone(),
|
||||
const_: variable.const_,
|
||||
mutable: variable.mutable,
|
||||
type_: Type::Identifier(self.circuit_name.as_ref().unwrap().clone()),
|
||||
span: variable.span.clone(),
|
||||
});
|
||||
}
|
||||
let type_ = self.canonicalize_self_type(Some(&variable.type_)).unwrap();
|
||||
|
||||
return FunctionInput::Variable(FunctionInputVariable {
|
||||
identifier: variable.identifier.clone(),
|
||||
const_: variable.const_,
|
||||
mutable: variable.mutable,
|
||||
type_,
|
||||
span: variable.span.clone(),
|
||||
});
|
||||
}
|
||||
|
||||
input.clone()
|
||||
|
@ -20,7 +20,7 @@ circuit Foo {
|
||||
y[Self {x: 0}.x] += 2;
|
||||
}
|
||||
|
||||
function func() {
|
||||
function func(a: [Self; 3], y: (Self)) {
|
||||
const x: Self = Foo {x: Self {x: 1}.x};
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@ outputs:
|
||||
r0:
|
||||
type: bool
|
||||
value: "true"
|
||||
initial_ast: d8ff1c8c84bc93bbd4e712dde7eb3c9dbe433199f5902b6dc3329cf3ca607811
|
||||
imports_resolved_ast: d8ff1c8c84bc93bbd4e712dde7eb3c9dbe433199f5902b6dc3329cf3ca607811
|
||||
canonicalized_ast: 9ef4d52afc2cbbcaa7759af48d1603feb28287d619293135a7856625a37299f7
|
||||
type_inferenced_ast: f3a91e1cd91f60c94ffe809369eeecb2f22996b6f14c1589a5c7a825519a6b1e
|
||||
initial_ast: ec52d3b3e69bef6d104f2dcfa9e713a728d7b0e15439c9da3b521b6cbfe719d4
|
||||
imports_resolved_ast: ec52d3b3e69bef6d104f2dcfa9e713a728d7b0e15439c9da3b521b6cbfe719d4
|
||||
canonicalized_ast: c85604dd75a964f7a6cfc0dddbeeeccf28a7c43915b944740528a0ff6230db78
|
||||
type_inferenced_ast: 258670051ac595a600362cb5a6793fb5ba9361cd914f7483057ad66204fc1b36
|
||||
|
Loading…
Reference in New Issue
Block a user