Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when trying to reference mutable variable in REPL #108

Closed
mtshiba opened this issue Sep 1, 2022 · 0 comments · Fixed by #151
Closed

Crash when trying to reference mutable variable in REPL #108

mtshiba opened this issue Sep 1, 2022 · 0 comments · Fixed by #151
Assignees
Labels

Comments

@mtshiba
Copy link
Member

mtshiba commented Sep 1, 2022

Reproducible code

>>> i = !100
>>> i

Expected behavior

1

Result

[DEBUG] compiler\erg_compiler\compile.rs:0161: the compiling process has started
[DEBUG] compiler\erg_parser\parse.rs:0369: the parsing process has started.
[DEBUG] compiler\erg_parser\parse.rs:0370: token stream: [Symbol i, EOF ]
[DEBUG] compiler\erg_parser\parse.rs:0401:
  (1) entered try_reduce_module, cur: Symbol i
[DEBUG] compiler\erg_parser\parse.rs:1722:
   (2) entered try_reduce_expr, cur: Symbol i
[DEBUG] compiler\erg_parser\parse.rs:1866:
    (3) entered try_reduce_bin_lhs, cur: Symbol i
[DEBUG] compiler\erg_parser\parse.rs:1956:
     (4) entered try_reduce_call_or_acc, cur: Symbol i
[DEBUG] compiler\erg_parser\parse.rs:0665:
      (5) entered try_reduce_acc, cur: Symbol i
[DEBUG] compiler\erg_parser\parse.rs:0383: the parsing process has completed.
[DEBUG] compiler\erg_parser\parse.rs:0384: AST:
i
[DEBUG] compiler\erg_parser\parse.rs:0385: the desugaring process has started.
[DEBUG] compiler\erg_parser\parse.rs:0388: AST (desugared):
i
[DEBUG] compiler\erg_parser\parse.rs:0389: the desugaring process has completed.
[DEBUG] compiler\erg_compiler\lower.rs:0549: the AST lowering process has started.
[DEBUG] compiler\erg_compiler\lower.rs:0550: the type-checking process has started.
[DEBUG] compiler\erg_compiler\lower.rs:0522: entered lower_expr
[DEBUG] compiler\erg_compiler\lower.rs:0233: entered lower_acc(i)
[DEBUG] compiler\erg_compiler\lower.rs:0564: HIR (not derefed):
i (: Nat!)
[DEBUG] compiler\erg_compiler\lower.rs:0565: the type-checking process has completed, found errors: 0
[DEBUG] compiler\erg_compiler\lower.rs:0572: HIR:
i (: Nat!)
[DEBUG] compiler\erg_compiler\lower.rs:0573: the AST lowering process has completed.
[DEBUG] compiler\erg_compiler\effectcheck.rs:0080: the side-effects checking process has started.
[DEBUG] compiler\erg_compiler\effectcheck.rs:0106: the side-effects checking process has completed, found errors: 0
[DEBUG] compiler\erg_compiler\ownercheck.rs:0059: the ownership checking process has started.
[DEBUG] compiler\erg_compiler\ownercheck.rs:0191: drop: i (in 1)
thread 'main' panicked at 'variable not found: i', compiler\erg_compiler\ownercheck.rs:267:9
stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/9067d5277d10f0f32a49ec9c125a33828e26a32b/library\std\src\panicking.rs:584
   1: core::panicking::panic_fmt
             at /rustc/9067d5277d10f0f32a49ec9c125a33828e26a32b/library\core\src\panicking.rs:142
   2: erg_compiler::ownercheck::OwnershipChecker::drop
             at .\compiler\erg_compiler\ownercheck.rs:267
   3: erg_compiler::ownercheck::OwnershipChecker::check_acc
             at .\compiler\erg_compiler\ownercheck.rs:196
   4: erg_compiler::ownercheck::OwnershipChecker::check_expr
             at .\compiler\erg_compiler\ownercheck.rs:98
   5: erg_compiler::ownercheck::OwnershipChecker::check
             at .\compiler\erg_compiler\ownercheck.rs:64
   6: erg_compiler::compile::Compiler::compile
             at .\compiler\erg_compiler\compile.rs:179
   7: erg_compiler::compile::Compiler::compile_and_dump_as_pyc<str>
             at .\compiler\erg_compiler\compile.rs:154
   8: erg::dummy::impl$0::eval
             at .\src\dummy.rs:101
   9: erg_common::traits::Runnable::run<erg::dummy::DummyVM>
             at .\compiler\erg_common\traits.rs:366
  10: erg::main
             at .\src\main.rs:32
  11: core::ops::function::FnOnce::call_once<void (*)(),tuple$<> >
             at /rustc/9067d5277d10f0f32a49ec9c125a33828e26a32b\library\core\src\ops\function.rs:248
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Traceback (most recent call last):
  File "<string>", line 18, in <module>
ConnectionAbortedError: [WinError 10053] 確立された接続がホスト コンピューターのソウトウェアによって中止されました。
error: process didn't exit successfully: `target\debug\erg.exe` (exit code: 101)
@mtshiba mtshiba added bug Something isn't working bug-compiler bug-ownership labels Sep 1, 2022
@mtshiba mtshiba changed the title Error when trying to reference mutable variable in REPL Crash when trying to reference mutable variable in REPL Sep 1, 2022
@mtshiba mtshiba self-assigned this Sep 1, 2022
mtshiba added a commit that referenced this issue Sep 12, 2022
mtshiba added a commit that referenced this issue Sep 12, 2022
Fix #108 (`OwnershipChecker` bugs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant