Comma warning detection seem wrong

Please select what you are reporting on:

Creative

What Type of Bug are you experiencing?

Assets

Summary

This produces the comma warning (inside a transacts/decides function)

ScreenX >= 0.0, ScreenX <= 1.0, ScreenY >= 0.0, ScreenY <= 1.0

I don’t see any new line seperator here, shouldn’t produce a warning

The warning fixes when you do this

ScreenX >= 0.0
ScreenX <= 1.0
ScreenY >= 0.0
ScreenY <= 1.0

Which obviously not the best method to write it

Steps to Reproduce

This produces the comma warning (inside a transacts/decides function)

ScreenX >= 0.0, ScreenX <= 1.0, ScreenY >= 0.0, ScreenY <= 1.0

Expected Result

I don’t see any new line seperator here, shouldn’t produce a warning

Observed Result

Produces a warning

Platform(s)

PC

In your example, what does the surrounding code look like?

This warning is also not meant to tell you that your code is incorrect, but that it’s hitting a bug in our code. In particular, this code:

DoSomething1[]
ScreenX >= 0.0, ScreenX <= 1.0, ScreenY >= 0.0, ScreenY <= 1.0
DoSomething2[]

is currently being parsed as if you wrote:

DoSomething1[]
block:
    ScreenX >= 0.0, ScreenX <= 1.0, ScreenY >= 0.0, ScreenY <= 1.0
DoSomething2[]

That extra block doesn’t cause any problems in this code because the code is just being run to see if one of the comparisons fails, but in other cases it causes unexpected scoping of definitions. For example:

A := 0, # <- note the comma here
B := 1  # <- and no comma here
C := 2

Is being parsed as:

block:
    A := 0,
    B := 1
C := 2

The extra block there changes the scope of the A and B definitions in a surprising and undesirable way.

See Verse Deprecation Messaging for more information about our strategy for making backward incompatible changes to the language. When we release a new version of the Verse language in the future that fixes this bug, if you have this warning in your code, you will not be able to opt into the new version without the risk of breaking your code.

For your example, you should be able to use semicolons to avoid the bug and the warning without splitting your code over multiple lines:

ScreenX >= 0.0; ScreenX <= 1.0; ScreenY >= 0.0; ScreenY <= 1.0

I was wondering you would ask this, well the previous and next statements are not failable

Here’s the full thing

WorldToScreen(
    Character: fort_character,
    WorldPoint: vector3,
    ?ScreenWidth: float = 1920.0,
    ?ScreenHeight: float = 1080.0,
    ?Fov: float = 80.0 # Vertical Fov!
)<decides><transacts>:vector2=
    LocalSpace := Character.GetViewRotation().UnrotateVector(WorldPoint-Character.GetViewLocation())
    
    LocalSpace.X > 0.1

    ScaleFactor := (1.0 / Tan(DegreesToRadians(Fov) * 0.5)) /LocalSpace.X
    
    ClipSpace := vector3{
        Y:= LocalSpace.Y * ScaleFactor,
        Z:= LocalSpace.Z * ScaleFactor/(ScreenHeight/ScreenWidth)
    }
    ViewSpace := vector3{
        Y:= ClipSpace.Y * 0.5 + 0.5,
        Z:= ClipSpace.Z * 0.5 + 0.5
    }

    ScreenX := ViewSpace.Y
    ScreenY := 1.0-ViewSpace.Z

    ScreenX >= 0.0
    ScreenX <= 1.0
    ScreenY >= 0.0
    ScreenY <= 1.0

    return vector2{X:=ScreenX, Y:=ScreenY}