Open sayomaki opened 1 year ago
This issue persists as of today.
The issue where imports do not carry over in assessment prelude and from the main code editor (on the left in playground) has been resolved in #1625, however importing new names in REPL issue still persists.
The issue title and post has been updated accordingly to reflect the updated issue.
EDIT: Imports in prelude and in main editor have been resolved as of #1625.
The issue left is importing new names in the REPL, refer to the same example below for a reproduction of the issue.
Here is the original issue:
When importing module functions and not using it directly (in the current program), this will lead to them being undeclared, i.e. using it in another program sharing the same context will lead to an error with name being undeclared.
However, this is not an issue/the case with the default source versions.
This causes issues when trying to execute module functions under REPL in different cells, or in the case of assessments, any module functions imported in the prepend chunk will not be declared and imported properly in the student's running program. (see examples below)
Affected Chapters & Variants
Affected Modules
Reproduction
1. Playground
Run these 2 chunks of code in separate cells (in the REPL), and you will see that the only the first cell works correctly.
2. Assessment
Create any assessment with prepend importing a module, then set the interpreter variant to native. You will see that the imported module functions do not work in the assessment. (see https://github.com/source-academy/frontend/issues/2419#issuecomment-1763694711)
Workarounds