Odin icon indicating copy to clipboard operation
Odin copied to clipboard

Multiline ternary expression fails syntax check

Open thePHTest opened this issue 2 years ago • 1 comments

Context

Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.

  • Operating System & Odin Version:
  • Please paste odin report output: Odin: dev-2022-11:6fa0679b OS: Windows 11 Home Basic (version: 21H2), build 22000.1219 CPU: 11th Gen Intel(R) Core(TM) i7-11370H @ 3.30GHz RAM: 32602 MiB

Expected Behavior

Compiles.

Current Behavior

Fails with syntax error.

Failure Information (for bugs)

These two multiline ternary expressions fail to compile:

	val := 1 \
		if true else 2
	val := 1 \
		if true \
		else 2

This one compiles and works:

	val := 1 if true \
		else 2

Failure Logs

Syntax Error: Expected '{', got 'else'

thePHTest avatar Dec 01 '22 18:12 thePHTest

I get syntax errors for the first two and the third compiles as stated. I'm not sure about the rules for multiline statements in the language, so it's something Bill would have to weigh in on.

Feoramund avatar Jun 09 '25 18:06 Feoramund