8000 [BUG] Type Annotation Fails on Implicit Variable Declarations · Issue #3415 · modular/modular · GitHub
[go: up one dir, main page]

Skip to content
[BUG] Type Annotation Fails on Implicit Variable Declarations #3415
@sibarras

Description

@sibarras

Bug description

Recently on Nightly we are allowed to implicitly create a variable, without the var keyword. Still we cannot annotate those variables with a type, or create a uninitialized variable.

Steps to reproduce

struct Foo:
    var i: Int

    fn __init__(inout self, i: Int):
        self.i = i


fn m():
    # No Annotations
    var f3 = Foo(1)  # ok
    f4 = Foo(1)  # ok

    # With Annotations
    var f5: Foo = 1  # ok
    f5: Foo = 1  # fails

    # Uninitialized
    var f: Foo  # ok
    f2: Foo  # fails

System information

- Sonoma 14.5 Mac M1
- mojo 2024.8.2419 (1fdb01e1)
- modular 0.9.2 (b3079bd5)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingmojoIssues that are related to mojomojo-repoTag all issues with this label

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0