Verse compiler mistreats ToString(:logic) as ToString(:[]char)

Summary

I have a simple function ToString(Val:logic) : string = if (Val?). "true" else "false" that I’d like to use to cast a logic value to a string (since Verse doesn’t do it by itself), but the compiler throws the following error:

“The function (/theuser@fortnite.com/TheProject:)ToString(:logic) in package TheProject is ambiguous with this definition:
function (/Verse.org/Verse:)ToString(:char) in package Verse(3532)”

I was able to make a similar function that received an enum and it didn’t complain.

I didn’t find a ToString(:[]char) function in the Verse.digest file, although I found the same named function for a single char, string, int or float value.

The reason I want this to work is that I want to be able to write Print("Value is {LogicVar}"), as it did work with the enum value, and because writing Print("Value is {LogicVar.ToString()}") seems out of pattern and unnecessary long (if we account that the autocomplete for Verse in VSCode doesn’t work at all)

Please select what you are reporting on:

Verse

What Type of Bug are you experiencing?

Verse

Steps to Reproduce

  1. Create a global function like this: ToString(Val:logic) : string = if (Val?). "true" else "false"
  2. Wait for the compiler to evaluate the code, or go to UEFN and hit Verse > Build Verse Code (Ctrl+Shift+B)

Expected Result

The compiler will identify that the type of the parameter is logic and not []char, and will not throw any errors.

Observed Result

The compiler throws an error.

Platform(s)

PC

Hey @Jimbohalo10,

In my function, logic is used as the type:

ToString(Val:logic) : string = if (Val?). "true" else "false"