vlang / v

Simple, fast, safe, compiled language for developing maintainable software. Compiles itself in <1s with zero library dependencies. Supports automatic C => V translation. https://vlang.io
MIT License
35.64k stars 2.15k forks source link

Hot reload failure when use time.now() in it #19456

Open Air-EL opened 11 months ago

Air-EL commented 11 months ago

Describe the bug

When use println('Time: ${time.now()}') in hot reload function, error will be caused. But if just don't output time string, there is not error.

Reproduction Steps

src code

module main

import time

[live]
fn print_message() {
    println('Hello! Modify this message while the program is running. 1')
}

[live]
fn print_message2() {
    t := time.now()
    println('Time: ${t}')
    println('Hello! Modify this message while the program is running. 2')
}

fn main() {
    for {
        print_message()
        print_message2()
        time.sleep(500 * time.millisecond)
    }
}

execute cmd v -live run main.v

Expected Behavior

Hello! Modify this message while the program is running. 1
Time: [time]
Hello! Modify this message while the program is running. 2

Current Behavior

output

Hello! Modify this message while the program is running. 1
Unhandled Exception 0xC0000005
print_backtrace_skipping_top_frames is not implemented
signal 11: segmentation fault
print_backtrace_skipping_top_frames is not implemented

Possible Solution

No response

Additional Information/Context

No response

V version

V 0.4.1 981f76c

Environment details (OS name and version, etc.)

V full version: V 0.4.1 981f76c OS: windows, Microsoft Windows 10 רҵ v19043 64 λ Processor: 16 cpus, 64bit, little endian,

vexe mtime: 2023-09-27 15:26:57

Git version: git version 2.39.2.windows.1 Git vroot status: weekly.2023.39-5-g981f76cd-dirty

[!NOTE] You can vote for this issue using the 👍 reaction. More votes increase the issue's priority for developers.

Take into account that only the 👍 reaction counts as a vote. Only reactions to the issue itself will be counted as votes, not comments.

spytheman commented 10 months ago

I can not reproduce it on linux and macos.

xenoken commented 3 months ago

I can't reproduce the issue on Windows either. ( tested on V 0.4.5 a924737 )