The difference comes from how Ruby parses line breaks and arguments inside parentheses
in your second case:
puts(x
-y)
Ruby doesnt see this as (x-y)
it actually parses it as (x,-y)
to get expected -1:
puts(x-y)
or
puts(x\
-y)
this isn't a bug just rubys parsing rule