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

Cgen declares variable in expressions #20127

Closed
MCausc78 opened this issue Dec 9, 2023 · 0 comments · Fixed by #20129
Closed

Cgen declares variable in expressions #20127

MCausc78 opened this issue Dec 9, 2023 · 0 comments · Fixed by #20129
Assignees
Labels
Bug This tag is applied to issues which reports bugs.

Comments

@MCausc78
Copy link
Contributor

MCausc78 commented Dec 9, 2023

Describe the bug

<title>

Reproduction Steps

pub struct Client {
pub:
    token      string
    intents    int
mut:
    ready    bool
    sequence ?int
}

enum Intents { foo }

pub type IntentsOrInt = Intents | int

@[params]
pub struct BotConfig {
pub:
    intents IntentsOrInt
}

pub fn bot(token string, config BotConfig) Client {
    return Client{
        token: 'Bot ${token}'
        intents: match config.intents {
            Intents { int(config.intents) }
            int { config.intents }
        }
    }
}

fn main() {}

Expected Behavior

Successful compile

Current Behavior

==================
C:/Users/mclr/AppData/Local/Temp/v_0/repro.10728893038999124359.tmp.c:6863: warning: implicit declaration of function 'tcc_backtrace'
C:/Users/mclr/AppData/Local/Temp/v_0/repro.10728893038999124359.tmp.c:12832: error: ')' expected (got "_option_int")
...
==================
(Use `v -cg` to print the entire error message)

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

This is a compiler bug, please report it using `v bug file.v`.

https://github.com/vlang/v/issues/new/choose

You can also use #help on Discord: https://discord.gg/vlang

Possible Solution

No response

Additional Information/Context

No response

V version

V 0.4.3 08189d6

Environment details (OS name and version, etc.)

V full version: V 0.4.3 140c838.08189d6
OS: windows, Microsoft Windows 11 Pro v22000 64-bit
Processor: 12 cpus, 64bit, little endian, 

getwd: D:\Games\Proekti\V\interactions
vexe: D:\Games\Proekti\V\v\v.exe
vexe mtime: 2023-12-09 09:55:27

vroot: OK, value: D:\Games\Proekti\V\v
VMODULES: OK, value: C:\Users\mclr\.vmodules
VTMP: OK, value: C:\Users\mclr\AppData\Local\Temp\v_0

Git version: git version 2.37.0.windows.1
Git vroot status: weekly.2023.48-76-g08189d64
.git/config present: true

CC version:
thirdparty/tcc status: thirdparty-windows-amd64 e90c2620

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.

@MCausc78 MCausc78 added the Bug This tag is applied to issues which reports bugs. label Dec 9, 2023
@felipensp felipensp self-assigned this Dec 9, 2023
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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants