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

as cast: cannot cast v.ast.UnknownTypeInfo to v.ast.Array #23704

Open
quaesitor-scientiam opened this issue Feb 13, 2025 · 6 comments
Open

as cast: cannot cast v.ast.UnknownTypeInfo to v.ast.Array #23704

quaesitor-scientiam opened this issue Feb 13, 2025 · 6 comments
Labels
Bug This tag is applied to issues which reports bugs. Status: Confirmed This bug has been confirmed to be valid by a contributor.

Comments

@quaesitor-scientiam
Copy link
Contributor

quaesitor-scientiam commented Feb 13, 2025

V version: V 0.4.9 2744f38, press to see full `v doctor` output

launch_tool vexe : S:\repo\vlang\v.exe
launch_tool vroot : S:\repo\vlang
launch_tool tool_source : S:\repo\vlang\cmd\tools\vdoctor.v
launch_tool tool_exe : S:\repo\vlang\cmd\tools\vdoctor.exe
launch_tool tool_args : "-v" "doctor"
launch_tool should_compile: true
Compiling vdoctor with: ""S:\repo\vlang\v.exe" -g "S:\repo\vlang\cmd\tools\vdoctor.v""

V full version V 0.4.9 45fd7eb.2744f38
OS windows, Microsoft Windows 11 Pro 26100 64-bit
Processor 24 cpus, 64bit, little endian, AMD Ryzen 9 5900X 12-Core Processor
Memory 103.29GB/127.92GB
V executable S:\repo\vlang\v.exe
V last modified time 2025-02-12 23:30:54
V home dir OK, value: S:\repo\vlang
VMODULES OK, value: C:\Users\john3.vmodules
VTMP OK, value: S:\temp\v_0
Current working dir OK, value: S:\vProjects\vDebug
Git version git version 2.45.1.windows.1
V git status weekly.2025.05-130-g2744f388
.git/config present true
cc version N/A
gcc version N/A
clang version clang version 18.1.8
msvc version Microsoft (R) C/C++ Optimizing Compiler Version 19.42.34435 for x64
tcc version tcc version 0.9.27 (x86_64 Windows)
tcc git status thirdparty-windows-amd64 b425ac82
emcc version N/A
glibc version ldd (cygwin) 3.5.4

What did you do?
./v -g -o vdbg cmd/v && ./vdbg -color -g -no-parallel -no-retry-compilation -o S:\vProjects\vDebug\main.exe -g -no-builtin S:\vProjects\vDebug\main.v && S:\vProjects\vDebug\main.exe
See attached file S:\vProjects\vDebug\main.v

What did you see?

all .v files before:
v.pref.no_builtin is true, get_builtin_files == []
get_v_files(S:\vProjects\vDebug\main.v)
> just compile one file: "S:\vProjects\vDebug\main.v"
user_files: ['S:\vProjects\vDebug\main.v']
x: "S:\vProjects\vDebug\modules"
v.module_search_paths:
['S:\vProjects\vDebug', 'S:\repo\vlang\vlib', 'C:\Users\john3\.vmodules']
all .v files:
['S:\vProjects\vDebug\main.v']
build_c(S:\temp\v_0\main.exe.01JKYMAPW40M91WKN5Y8VPBJ5A.tmp.c)
�[1m0.929   �[22m ms Builder.front_stages.parse_files
  >> trying to find v.builder.nativebuilder in S:\vProjects\vDebug\v\builder\nativebuilder ..
  >> trying to find v.builder.nativebuilder in 
> [!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.
Copy link

Connected to Huly®: V_0.6-22123

@quaesitor-scientiam
Copy link
Contributor Author

module main

import v.builder.nativebuilder

fn main() {
	nativebuilder.start()
}

@JalonSolov
Copy link
Contributor

This is failing in V itself, when compiled with v -o vdbg self. On Linux, I see this:

$ v -g -o vdbg self && git/v/vdbg -color -g -no-parallel -no-retry-compilation -no-builtin main.v && ./main
V self compiling (-g -o vdbg)...
================ V panic ================
   module: builtin
 function: __as_cast()
  message: as cast: cannot cast `v.ast.UnknownTypeInfo` to `v.ast.Array`
     file: /home/jalon/git/v/vlib/builtin/builtin.v:34
   v hash: 92f436d
=========================================
/tmp/v_1000/../../../../../../home/jalon/git/v/vlib/builtin/builtin.c.v:87: at panic_debug: Backtrace
/tmp/v_1000/../../../../../../home/jalon/git/v/vlib/builtin/builtin.v:34: by __as_cast
/tmp/v_1000/../../../../../../home/jalon/git/v/vlib/v/ast/table.v:946: by v__ast__Table_known_type_idx
/tmp/v_1000/../../../../../../home/jalon/git/v/vlib/v/ast/table.v:1501: by v__ast__Table_known_type_names
/tmp/v_1000/../../../../../../home/jalon/git/v/vlib/v/checker/checker.v:5343: by v__checker__Checker_ensure_type_exists
/tmp/v_1000/../../../../../../home/jalon/git/v/vlib/v/checker/fn.v:370: by v__checker__Checker_fn_decl
/tmp/v_1000/../../../../../../home/jalon/git/v/vlib/v/checker/checker.v:2329: by v__checker__Checker_stmt
/tmp/v_1000/../../../../../../home/jalon/git/v/vlib/v/checker/checker.v:274: by v__checker__Checker_check
/tmp/v_1000/../../../../../../home/jalon/git/v/vlib/v/checker/checker.v:334: by v__checker__Checker_check_files
/tmp/v_1000/../../../../../../home/jalon/git/v/vlib/v/builder/builder.v:131: by v__builder__Builder_middle_stages
/tmp/v_1000/../../../../../../home/jalon/git/v/vlib/v/builder/builder.v:163: by v__builder__Builder_front_and_middle_stages
/tmp/v_1000/../../../../../../home/jalon/git/v/vlib/v/builder/cbuilder/cbuilder.v:72: by v__builder__cbuilder__gen_c
/tmp/v_1000/../../../../../../home/jalon/git/v/vlib/v/builder/cbuilder/cbuilder.v:60: by v__builder__cbuilder__build_c
/tmp/v_1000/../../../../../../home/jalon/git/v/vlib/v/builder/cbuilder/cbuilder.v:50: by v__builder__cbuilder__compile_c
/tmp/v_1000/../../../../../../home/jalon/git/v/vlib/v/builder/rebuilding.v:325: by v__builder__Builder_rebuild
/tmp/v_1000/../../../../../../home/jalon/git/v/vlib/v/builder/compile.v:17: by v__builder__compile
/tmp/v_1000/../../../../../../home/jalon/git/v/cmd/v/v.v:189: by main__rebuild
/tmp/v_1000/../../../../../../home/jalon/git/v/cmd/v/v.v:147: by main__main
/tmp/v_1000/../../../../../../tmp/v_1000/vdbg.01JKYNV2STYKGZWB21R25JCPT7.tmp.c:38039: by main
$

Since the example is to be built with -no-builtin, it is not coming from there. It also isn't coming from the v self part, as if I remove that, it still fails with the same error/traceback.

@JalonSolov JalonSolov added Bug This tag is applied to issues which reports bugs. Status: Confirmed This bug has been confirmed to be valid by a contributor. labels Feb 13, 2025
@JalonSolov
Copy link
Contributor

I tried again just running V instead of the vdbg version:

$ v  -color -g -no-parallel -no-retry-compilation -no-builtin main.v
V panic: as cast: cannot cast `v.ast.UnknownTypeInfo` to `v.ast.Array`
v hash: 92f436d
/tmp/v_1000/v2.01JKX76MHTBYCBDYAMS7PE91MG.tmp.c:19288: at _v_panic: Backtrace
/tmp/v_1000/v2.01JKX76MHTBYCBDYAMS7PE91MG.tmp.c:19757: by __as_cast
/tmp/v_1000/v2.01JKX76MHTBYCBDYAMS7PE91MG.tmp.c:37329: by v__ast__Table_known_type_idx
/tmp/v_1000/v2.01JKX76MHTBYCBDYAMS7PE91MG.tmp.c:37746: by v__ast__Table_known_type_names
/tmp/v_1000/v2.01JKX76MHTBYCBDYAMS7PE91MG.tmp.c:55379: by v__checker__Checker_ensure_type_exists
/tmp/v_1000/v2.01JKX76MHTBYCBDYAMS7PE91MG.tmp.c:59741: by v__checker__Checker_fn_decl
/tmp/v_1000/v2.01JKX76MHTBYCBDYAMS7PE91MG.tmp.c:51751: by v__checker__Checker_stmt
/tmp/v_1000/v2.01JKX76MHTBYCBDYAMS7PE91MG.tmp.c:49627: by v__checker__Checker_check
/tmp/v_1000/v2.01JKX76MHTBYCBDYAMS7PE91MG.tmp.c:49690: by v__checker__Checker_check_files
/tmp/v_1000/v2.01JKX76MHTBYCBDYAMS7PE91MG.tmp.c:48693: by v__builder__Builder_middle_stages
/tmp/v_1000/v2.01JKX76MHTBYCBDYAMS7PE91MG.tmp.c:48731: by v__builder__Builder_front_and_middle_stages
/tmp/v_1000/v2.01JKX76MHTBYCBDYAMS7PE91MG.tmp.c:51239: by v__builder__cbuilder__gen_c
/tmp/v_1000/v2.01JKX76MHTBYCBDYAMS7PE91MG.tmp.c:51211: by v__builder__cbuilder__build_c
/tmp/v_1000/v2.01JKX76MHTBYCBDYAMS7PE91MG.tmp.c:51202: by v__builder__cbuilder__compile_c
/tmp/v_1000/v2.01JKX76MHTBYCBDYAMS7PE91MG.tmp.c:51119: by v__builder__Builder_rebuild
/tmp/v_1000/v2.01JKX76MHTBYCBDYAMS7PE91MG.tmp.c:50272: by v__builder__compile
/tmp/v_1000/v2.01JKX76MHTBYCBDYAMS7PE91MG.tmp.c:51630: by main__rebuild
/tmp/v_1000/v2.01JKX76MHTBYCBDYAMS7PE91MG.tmp.c:51585: by main__main
/tmp/v_1000/v2.01JKX76MHTBYCBDYAMS7PE91MG.tmp.c:52282: by main
$

@JalonSolov
Copy link
Contributor

If you leave out the -no-builtin switch, it compiles clean.

@quaesitor-scientiam
Copy link
Contributor Author

It does for me too. But @spytheman advise me to use -no-builtin for the initial native work. So it needs to be fixed.

@felipensp felipensp self-assigned this Feb 14, 2025
@felipensp felipensp removed their assignment Feb 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This tag is applied to issues which reports bugs. Status: Confirmed This bug has been confirmed to be valid by a contributor.
Projects
None yet
Development

No branches or pull requests

3 participants