ID:2920006
 
Resolved
The parser was confused by proc return types joining two primitives, e.g. "as num|text".
BYOND Version:515
Operating System:Windows 10 Pro 64-bit
Web Browser:Firefox 124.0
Applies to:Dream Maker
Status: Resolved (515.1636)

This issue has been resolved.
Descriptive Problem Summary:
Union return types for procs (null|text, num|text, anything using |) cause compilation errors.

Numbered Steps to Reproduce Problem:
  1. Have a proc with a union return type, like null|text.
  2. Try to compile.


Code Snippet (if applicable) to Reproduce Problem:
/proc/sanitize(input as text|message|null, max_length = 50, encode = TRUE, trim = TRUE, extra = TRUE, ascii_only = FALSE) as null|text
return "foo"
/proc/main()
sanitize("yeet")


Expected Results:
Compiles fine.

Actual Results:
DM compiler version 515.1634
loading code.dm
code.dm:5:error: return type (|) must be a type path or atomic (num, text, atom, etc.)
code.dm.dmb - 1 error, 0 warnings (4/6/24 10:42 pm)
Total time: 0:00


Does the problem occur:
Every time? Or how often? Any time a proc has a union return type.
In other games? If they have procs with a union return type.
In other user accounts? If those accounts compile code with a proc that has a union return type.
On other computers? If those computers compile code with a proc that has a union return type.

When does the problem NOT occur?
When the proc has no return type, has a primitive (non-union) return type, or the type annotation is on an argument or variable instead of the proc.

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)
Far as I know it's happened since proc return types were introduced.

Workarounds:
Just don't use a union return type.
Lummox JR resolved issue with message:
The parser was confused by proc return types joining two primitives, e.g. "as num|text".