You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a function returns a value, and if it is not assigned to a variable, the compiler detects this as an error “Mismatched types. Expected type(), found type u32 ”
At the same time, if the function does not return a value, then it can be assigned to a variable as well as could be called without being assigned. Looks like an incorrect behaviour.
Steps to Reproduce
Code snippet to reproduce
function excar () {
let ex = 33u32;
}
function exbaz () -> u32 {
return 33u32
}
function main() {
let excar1 = excar();
excar();
let exbaz1 = exbaz();
exbaz();
}
Stack trace & error message
Compiling Starting...
Compiling Compiling main program... ("c:\\Users\\test\\Aleo Studio\\function-return\\src/main.leo")
Compiling --> "c:\\Users\\test\\Aleo Studio\\function-return\\src/main.leo": 13:5
|
13 | exbaz();
| ^^^^
|
= Mismatched types. Expected type `()`, found type `u32`.
Error: Crate("leo-compiler", "Program failed due to previous error")
Expected Behavior
(Write what you expected to happen here)
Your Environment
leo 1.0.7
rust 1.48.0
Edition: Windows 10 Pro
Version: 20H2
OS build: 19042.685
Experience: Windows Feature Experience Pack 120.2212.551.0
The text was updated successfully, but these errors were encountered:
🐛 Bug Report
If a function returns a value, and if it is not assigned to a variable, the compiler detects this as an error “Mismatched types. Expected type
()
, found typeu32
”At the same time, if the function does not return a value, then it can be assigned to a variable as well as could be called without being assigned. Looks like an incorrect behaviour.
Steps to Reproduce
Code snippet to reproduce
Stack trace & error message
Expected Behavior
(Write what you expected to happen here)
Your Environment
OS build: 19042.685
Experience: Windows Feature Experience Pack 120.2212.551.0
The text was updated successfully, but these errors were encountered: