Skip to content

v repl output weird memory content #24499

Description

@iacore

Describe the bug

❯ v
 ____    ____ 
 \   \  /   /  |  Welcome to the V REPL (for help with V itself, type  exit , then run  v help ).
  \   \/   /   |  Note: the REPL is highly experimental. For best V experience, use a text editor, 
   \      /    |  save your code in a  main.v  file and execute:  v run main.v 
    \    /     |  V 0.4.10 ded45dc . Use  list  to see the accumulated program so far.
     \__/      |  Use Ctrl-C or  exit  to exit, or  help  to see other available commands.

>>> a := error("hi")
>>> typeof(a)
warning: use e.g. `typeof(expr).name` or `sum_type_instance.type_name()` instead
    6 | 
    7 | a := error("hi")
    8 | println(typeof(a))
      |         ~~~~~~
IError
>>> typeof(a)
 println(typeof(a))
warning: use e.g. `typeof(expr).name` or `sum_type_instance.type_name()` instead
    7 | a := error("hi")
    8 | println(typeof(a))
    9 | println(typeof(a))
      |         ~~~~~~
IError
IError
>>> typeof(a)
~~
   10 | println(typeof(a))
warning: use e.g. `typeof(expr).name` or `sum_type_instance.type_name()` instead
    8 | println(typeof(a))
    9 | println(typeof(a))
   10 | println(typeof(a))
      |         ~~~~~~
IError
IError
IError
>>> typeof(a)

   11 | println(typeof(a))
warning: use e.g. `typeof(expr).name` or `sum_type_instance.type_name()` instead
    9 | println(typeof(a))
   10 | println(typeof(a))
   11 | println(typeof(a))
      |         ~~~~~~
IError
IError
IError
IError
>>> typeof(a)
  12 | println(typeof(a))
warning: use e.g. `typeof(expr).name` or `sum_type_instance.type_name()` instead
   10 | println(typeof(a))
   11 | println(typeof(a))
   12 | println(typeof(a))
      |         ~~~~~~
IError
IError
IError
IError
IError
>>> typeof(a)
println(typeof(a))
warning: use e.g. `typeof(expr).name` or `sum_type_instance.type_name()` instead
   11 | println(typeof(a))
   12 | println(typeof(a))
   13 | println(typeof(a))
      |         ~~~~~~
IError
IError
IError
IError
IError
IError
>>> typeof(a)
(typeof(a))
warning: use e.g. `typeof(expr).name` or `sum_type_instance.type_name()` instead
   12 | println(typeof(a))
   13 | println(typeof(a))
   14 | println(typeof(a))
      |         ~~~~~~
IError
IError
IError
IError
IError
IError
IError
>>> typeof(a)
(a))
warning: use e.g. `typeof(expr).name` or `sum_type_instance.type_name()` instead
   13 | println(typeof(a))
   14 | println(typeof(a))
   15 | println(typeof(a))
      |         ~~~~~~
IError
IError
IError
IError
IError
IError
IError
IError
>>> typeof(a)
warning: use e.g. `typeof(expr).name` or `sum_type_instance.type_name()` instead
   14 | println(typeof(a))
   15 | println(typeof(a))
   16 | println(typeof(a))
      |         ~~~~~~
IError
IError
IError
IError
IError
IError
IError
IError
IError
>>> 

Reproduction Steps

  1. Open v
  2. Type in the following line by line.
a := error("hi")
typeof(a)
typeof(a)
typeof(a)
typeof(a)
typeof(a)
typeof(a)
typeof(a)

Expected Behavior

It should not output weird stuff.

Current Behavior

see above

Possible Solution

No response

Additional Information/Context

No response

V version

V 0.4.10 ded45dc

Environment details (OS name and version, etc.)

V full version V 0.4.10 ded45dc
OS linux, "Artix Linux"
Processor 8 cpus, 64bit, little endian, Intel(R) Core(TM) i5-10300H CPU @ 2.50GHz
Memory 6.26GB/11.47GB
V executable /home/user/Applications/v/v
V last modified time 2025-05-14 20:52:11
V home dir OK, value: /home/user/Applications/v
VMODULES OK, value: /home/user/.vmodules
VTMP OK, value: /tmp/v_1000
Current working dir OK, value: /home/user
Git version git version 2.49.0
V git status d6e79ca1-dirty
.git/config present false
cc version cc (GCC) 15.1.1 20250425
gcc version gcc (GCC) 15.1.1 20250425
clang version clang version 19.1.7
tcc version tcc version 0.9.28rc 2025-02-13 HEAD@f8bd136d (x86_64 Linux)
tcc git status N/A
emcc version emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.39 (36f871819b566281d160470a1ec4515f379e9f77)
glibc version ldd (GNU libc) 2.41

Note

You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugThis tag is applied to issues which reports bugs.

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions