Skip to content

Bad error when declaring that a field is a vec3[f64] instead of a Vec3 #25452

Description

@Linklancien

Describe the bug

When we declare a struct with a field type vec3 the compiler doesn't report that it should be a Vec3 instead

Reproduction Steps

import math.vec {vec3, Vec3}

struct Struct_veca {
field vec3[f64]
}

fn main(){
f := vec3[f32](2_000, 0 ,0)
}

Expected Behavior

The deboger should indique that vec3[f64] is not a type and instead suggest that it may be a Vec3

Current Behavior

The code return an error in the vec3 file

/v/vlib/math/vec/vec3.v:384:19: error: unexpected token `,`, expecting `)` 382 | m := v.magnitude() 383 | if m == 0 { 384 | return vec3[T](0, 0, 0) | ^ 385 | } 386 | return Vec3[T]{

Possible Solution

No response

Additional Information/Context

No response

V version

V 0.4.12 f6e5118

Environment details (OS name and version, etc.)

linux, Linux version 6.11.7-300.fc41.x86_64 (mockbuild@6c49ea81e72a4908b02fd96c22f92edf) (gcc (GCC) 14.2.1 20240912 (Red Hat 14.2.1-3), GNU ld version 2.43.1-2.fc41) #1 SMP PREEMPT_DYNAMIC Fri Nov 8 19:23:10 UTC 2024

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.

Metadata

Metadata

Assignees

Labels

BugThis tag is applied to issues which reports bugs.

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions