Skip to content

Commit

Permalink
Merge pull request #28373 from ProvableHQ/issue-28370-resolve
Browse files Browse the repository at this point in the history
Add function inputs to the type table.
  • Loading branch information
d0cd authored Oct 3, 2024
2 parents 3dd2488 + 2919f0b commit 9457941
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
3 changes: 3 additions & 0 deletions compiler/passes/src/type_checking/checker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1239,6 +1239,9 @@ impl<'a, N: Network> TypeChecker<'a, N> {
self.handler.emit_err(err);
}
}

// Add the input to the type table.
self.type_table.insert(input_var.identifier().id(), input_var.type_().clone());
});

// Type check the function's return type.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
namespace: Compile
expectation: Pass
outputs:
- - compile:
- initial_symbol_table: 3a64910c315e257b67757ebc3478a2df7ff7aa2ae8ef8d258507e44b53942b82
type_checked_symbol_table: 69a0008fc51152856295a0ef75043069f34b5f0e1ce5b944e4d575a2d184a233
unrolled_symbol_table: 69a0008fc51152856295a0ef75043069f34b5f0e1ce5b944e4d575a2d184a233
initial_ast: 4c9ab22f340920e9a086b4b55e1e09065bf8839d7bf03d725003fc53cc6d5265
unrolled_ast: 4c9ab22f340920e9a086b4b55e1e09065bf8839d7bf03d725003fc53cc6d5265
ssa_ast: bf04c3808bc97d0b45f1e69cb8f9faed5f31e01cc03e359364bf22132b36216b
flattened_ast: cde3b5d0a6e6744e69645072cc44a21dd6a4ef77c087e4a0afab075abd3b7a70
destructured_ast: f10b829b1ac2863d3bc8cbf86b51c8947b5c1db6a0ebcb714d4c9f8f2dedb274
inlined_ast: f10b829b1ac2863d3bc8cbf86b51c8947b5c1db6a0ebcb714d4c9f8f2dedb274
dce_ast: 6fb7a52d2eeff93d53a26ddc38a0bdf71615b6aa7ab3ab22a894e96bd1d309f1
bytecode: e78a049b9529f1feeaa63bcf231b86c28e604487d185d98bbc0e4a2f201c3ec0
errors: ""
warnings: ""
13 changes: 13 additions & 0 deletions tests/tests/compiler/function/function_input_else_assignment.leo
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
namespace: Compile
expectation: Pass
*/

program test.aleo {
transition foo(a: u8) {
if false {
} else {
a = 0u8;
}
}
}

0 comments on commit 9457941

Please sign in to comment.