Skip to content

[Bug] V compiler not detecting type error for os.read_file "?string" type. #6392

@aqilc

Description

@aqilc

V version:

> v -v
V 0.1.29 35cbca9

OS: Windows 10 2004

What did you do?

// ./hello.v:

import os

fn main() {
    print("./rand: " + os.read_file("./rand"))
}
> v run "d:\projects\v\hello\hello.v"

What did you expect to see?

An error indicating that I was adding incompatible types(string and ?string).

What did you see instead?

==================
C:\Users\aqilc\AppData\Local\Temp\v\hello.tmp.c: In function 'main__main':
C:\Users\aqilc\AppData\Local\Temp\v\hello.tmp.c:10041:49: error: expected expression before 'Option_string'
  print(string_add(tos_lit("hewwo, heres rand"), Option_string _t191 = os__read_file(tos_lit("./rand"));
                                                 ^~~~~~~~~~~~~
C:\Users\aqilc\AppData\Local\Temp\v\hello.tmp.c: In function '_vinit':
C:\Users\aqilc\AppData\Local\Temp\v\hello.tmp.c:10070:38: warning: integer constant is so large that it is unsigned
  _const_math__bits__max_u64 = ((u64)(18446744073709551615));
                                      ^~~~~~~~~~~~~~~~~~~~
C:\Users\aqilc\AppData\Local\Temp\v\hello.tmp.c:10097:409: warning: integer constant is so large that it is unsigned
   ((u64)(1)), ((u64)(10)), ((u64)(100)), ((u64)(1000)), ((u64)(10000)), ((u64)(100000)), ((u64)(1000000)), ((u64)(10000000)), ((u64)(100000000)), ((u64)(1000000000)), ((u64)(10000000000)), ((u64)(100000000000)), ((u64)(1000000000000)), ((u64)(10000000000000)), ((u64)(100000000000000)), ((u64)(1000000000000000)), ((u64)(10000000000000000)), ((u64)(100000000000000000)), ((u64)(1000000000000000000)), ((u64)(10000000000000000000))}));
                                                                                                                                                                                                                                                                                                                                                                                                                         ^~~~~~~~~~~~~~~~~~~~
C:\Users\aqilc\AppData\Local\Temp\v\hello.tmp.c: In function 'wmain':
...
==================
(Use `v -cg` to print the entire error message)

builder error: 
==================
C error. This should never happen.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugThis tag is applied to issues which reports bugs.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions