"add missing expr concrete type check" breaks identifier resolution #142

Closed
opened 2021-12-20 18:21:59 +08:00 by sb10q · 1 comment

Commit cb450372d6 which I reverted causes a serious regression with identifier resolution.

To reproduce:

nix develop github:m-labs/artiq/243fe5ea881bd7481a29e622912b1e5d3c3554ef
cd artiq/examples/nac3devices
artiq_compile nac3devices.py

Result:

thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: "unknown identifier n_min (use before def?) at line 209 column 13"', nac3artiq/src/lib.rs:518:39
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Traceback (most recent call last):
  File "/nix/store/6yiqib07z41dq5da3wsm7z96zyfvflnx-python3.9-artiq-8.0-dev/bin/.artiq_compile-wrapped", line 9, in <module>
    sys.exit(main())
  File "/nix/store/04m032039l27k25726j0h0v99y19j6mf-python3-3.9.6-env/lib/python3.9/site-packages/artiq/frontend/artiq_compile.py", line 63, in main
    exp_inst.core.compile(exp_inst.run, [], {}, file_output=output)
  File "/nix/store/04m032039l27k25726j0h0v99y19j6mf-python3-3.9.6-env/lib/python3.9/site-packages/artiq/coredevice/core.py", line 77, in compile
    self.compiler.compile_method_to_file(obj, name, args, file_output)
pyo3_runtime.PanicException: called `Result::unwrap()` on an `Err` value: "unknown identifier n_min (use before def?) at line 209 column 13"
Commit cb450372d657d5d859f633fbeaf88fa80404bbb3 which I reverted causes a serious regression with identifier resolution. To reproduce: ``` nix develop github:m-labs/artiq/243fe5ea881bd7481a29e622912b1e5d3c3554ef cd artiq/examples/nac3devices artiq_compile nac3devices.py ``` Result: ``` thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: "unknown identifier n_min (use before def?) at line 209 column 13"', nac3artiq/src/lib.rs:518:39 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace Traceback (most recent call last): File "/nix/store/6yiqib07z41dq5da3wsm7z96zyfvflnx-python3.9-artiq-8.0-dev/bin/.artiq_compile-wrapped", line 9, in <module> sys.exit(main()) File "/nix/store/04m032039l27k25726j0h0v99y19j6mf-python3-3.9.6-env/lib/python3.9/site-packages/artiq/frontend/artiq_compile.py", line 63, in main exp_inst.core.compile(exp_inst.run, [], {}, file_output=output) File "/nix/store/04m032039l27k25726j0h0v99y19j6mf-python3-3.9.6-env/lib/python3.9/site-packages/artiq/coredevice/core.py", line 77, in compile self.compiler.compile_method_to_file(obj, name, args, file_output) pyo3_runtime.PanicException: called `Result::unwrap()` on an `Err` value: "unknown identifier n_min (use before def?) at line 209 column 13" ```

Hmmm, yes, the check expr is actually not needed. Sorry for didn't review it properly.

The one for Name is actually redundant (add the name to the defined identifiers and check if it is there...). The one for tuple is wrong because it would check if the other tuple values are valid expressions, which are not because they contain not yet defined identifiers.

Hmmm, yes, the check expr is actually not needed. Sorry for didn't review it properly. The one for Name is actually redundant (add the name to the defined identifiers and check if it is there...). The one for tuple is wrong because it would check if the other tuple values are valid expressions, which are not because they contain not yet defined identifiers.
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: M-Labs/nac3#142
There is no content yet.