mojo
mojo copied to clipboard
[BUG] Borrowed keyword does not work
Bug description
def func(borrowed y: Int) -> borrowed Int:
return y
def main():
var x: Int = 1
var ref = func(x)
print(ref)
/
Compile error:
/source/prog.mojo:1:30: error: unexpected token in expression
def func(borrowed y: Int) -> borrowed Int:
^
/source/prog.mojo:1:30: error: expected ':' in function definition
def func(borrowed y: Int) -> borrowed Int:
^
/source/prog.mojo:1:30: error: unexpected token in expression
def func(borrowed y: Int) -> borrowed Int:
^
mojo: error: failed to parse the provided Mojo
Steps to reproduce
- Include relevant code snippet or link to code that did not work as expected.
- If applicable, add screenshots to help explain the problem.
- If using the Playground, name the pre-existing notebook that failed and the steps that led to failure.
- Include anything else that might help us debug the issue.
System information
shell
- What OS did you do install Mojo on ?
### System information: OS : linux CPU : skylake-avx512 Arch : x86_64-unknown-linux-gnu Physical Cores : 4 Logical Cores : 8 CPU Features : sse4 avx avx2 avx512f
- [ ] https://docs.modular.com/mojo/playground
- Provide version information for Mojo by pasting the output of
mojo -v
24.2 - Provide Modular CLI version by pasting the output of
modular -v
---