Describe the bug
Alias types are not properly resolved when sum types are involved.
Reproduction Steps
Write a simple app:
type Type0 = string
type Type1 = Type0 | int
struct Foo {
field Type1
}
fn main () {
foo := Foo{}
if foo.field is Type0 {
assert foo.field == Type0 ('' )
} else {
assert false
}
}
Compile to JavaScript and execute it:
v -b js main.v
node main.js
Output:
FAIL: fn main.main(): assert false
Expected Behavior
It should NOT fail.
Current Behavior
It fails.
Possible Solution
No response
Additional Information/Context
No response
V version
V 0.4.10 2ca9209
Environment details (OS name and version, etc.)
V full version
V 0.4.10 dead5e6 .2ca9209
OS
macos, macOS, 15.4.1, 24E263
Processor
8 cpus, 64bit, little endian, Apple M1 Pro
Memory
0.15GB/16GB
V executable
/Users/gonzalo/Projects/Personal/v/nv/v
V last modified time
2025-05-14 14:46:58
V home dir
OK, value: /Users/gonzalo/Projects/Personal/v/nv
VMODULES
OK, value: /Users/gonzalo/.vmodules
VTMP
OK, value: /tmp/v_501
Current working dir
OK, value: /Users/gonzalo/Projects/Personal/v/nv
Git version
git version 2.39.1
V git status
weekly.2025.19-33-g2ca92090
.git/config present
true
cc version
Apple clang version 17.0.0 (clang-1700.0.13.3)
gcc version
Apple clang version 17.0.0 (clang-1700.0.13.3)
clang version
Apple clang version 17.0.0 (clang-1700.0.13.3)
tcc version
tcc version 0.9.28rc 2024-02-05 HEAD@105d70f7 (AArch64 Darwin)
tcc git status
thirdparty-macos-arm64 e447816
emcc version
N/A
glibc version
N/A
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.
Describe the bug
Alias types are not properly resolved when sum types are involved.
Reproduction Steps
Write a simple app:
Compile to JavaScript and execute it:
Output:
Expected Behavior
It should NOT fail.
Current Behavior
It fails.
Possible Solution
No response
Additional Information/Context
No response
V version
V 0.4.10 2ca9209
Environment details (OS name and version, etc.)
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.