Skip to content

fix vrepl: import sb { sth }#24340

Merged
spytheman merged 3 commits into
vlang:masterfrom
CryingN:fix_vrepl
Apr 28, 2025
Merged

fix vrepl: import sb { sth }#24340
spytheman merged 3 commits into
vlang:masterfrom
CryingN:fix_vrepl

Conversation

@CryingN

@CryingN CryingN commented Apr 27, 2025

Copy link
Copy Markdown
Contributor

In the V language's REPL, there exists:

>>> import term { red }
>>> red('test')
error: unknown function: red
    7 | import term
    8 |
    9 | red('test')
      | ~~~~~~~~~~~
>>> import term {
... red
... }
>>> red('test')
test

For the error case, I rewrote the library import logic, adding a list for each library to represent what it imports (or importing everything). The modified code resolves these issues. Due to my current limited abilities, I've also discovered some unstable hidden problems during testing. If not merged, I've also created a more aggressive fork repository vrepl for testing by replacing the vrepl program.

@huly-for-github

Copy link
Copy Markdown

Connected to Huly®: V_0.6-22716

@spytheman

Copy link
Copy Markdown
Contributor

Please add a .repl test in vlib/v/slow_tests/repl/ .
You can run them with ./v vlib/v/slow_tests/repl/repl_test.v .

@spytheman spytheman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work.

@spytheman spytheman merged commit 146c766 into vlang:master Apr 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants