Skip to content

Unary minus binds tighter than .. range operator, making-(1)..1 fail #67

Description

@Krutoy242

Issue Description:

Unary minus interacts incorrectly with the .. range operator. -(1) .. 1 parses as if -(1 .. 1).

Script used:

for i in  -1  .. 1 { print(i); } // ✅ Fine
for i in -(1) .. 1 { print(i); } // ❌ Syntax error

What happens:

test.zs:2 > cannot apply unary operators on int ranges
test.zs:2 > No iterator with 1 variables

What you expected to happen:

Both -1 .. 1 and -(1) .. 1 should produce same result.

Affected Versions:

  • Minecraft: 1.12.2
  • Forge: 14.23.5.2864
  • Crafttweaker: 4.1.20.715

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions