shiika icon indicating copy to clipboard operation
shiika copied to clipboard

Parse error with receiver-less predicate method call

Open yhara opened this issue 2 years ago • 1 comments

Given

class A
  def foo?(x: Object) -> Bool
    true
  end
  def bar
    foo?(1) or foo?(2)
  end
end

Result

Error: expected Colon but got Separator

Seems that ? is treated as conditional operator.

Workaround

Parse succeeds with explicit self.

class A
  def foo?(x: Object) -> Bool
    true
  end
  def bar
    self.foo?(1) or self.foo?(2)
  end
end

yhara avatar Jun 09 '22 06:06 yhara

It's good for me.

I'll work for this later.

yamakoud avatar Jan 04 '24 06:01 yamakoud