Giter Site home page Giter Site logo

Comments (3)

Mogball avatar Mogball commented on May 21, 2024

Thanks for the bug report! This seems specifically like a notebook environment bug, as it is occurring in top-level code (trying to do the same inside a function definition will cause a compilation error). @River707 I guess we need to track liveliness?

from mojo.

lattner avatar lattner commented on May 21, 2024

Yep, this is workbook toplevel code specific, thanks for reporting it!

from mojo.

gabrieldemarmiesse avatar gabrieldemarmiesse commented on May 21, 2024

Doing some triaging here, with Mojo 2024.1.0. I updated the example to reproduce the bug to the latest syntax:

struct Foo:
    var x: String
    fn __init__(inout self, owned x: String):
        self.x = x
    fn __moveinit__(inout self, owned existing: Self):
        self.x = existing.x

fn bar(owned foo: Foo) -> Int:
    return 2

var foo = Foo(String("test"))
print(bar(foo^))
print(bar(foo^))

We now get this output:

error: Expression [1]:12:14: cannot consume indirect references to values
print(bar(foo^))
             ^

error: Expression [1]:13:14: cannot consume indirect references to values
print(bar(foo^))
             ^

2
2

So we're getting errors in the output, but the notebook cell is still considered successful and the code is still executed. That's a different bug, but still a bug.

from mojo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.