Skip to content

Conversation

@christoph-dfinity
Copy link
Contributor

As there's no ambiguity arising from this, I think it's consistent and more convenient to group unary operator patterns (like case -1) with the other literals.

@christoph-dfinity christoph-dfinity requested a review from a team as a code owner October 27, 2025 08:48
@github-actions
Copy link
Contributor

Comparing from 82171b1 to c6bc1e0:
In terms of gas, no changes are observed in 5 tests.
In terms of size, no changes are observed in 5 tests.

@crusso
Copy link
Contributor

crusso commented Oct 27, 2025

I guess that's ok, but I think it might break the symmetry with expressions:


crusso@crusso-Virtual-Machine:~/motoko/src$ rlwrap moc
Motoko compiler (source 0.16.3-40-g5e9da46fa)
> func id(x:Int):Int{x};
let id : (x : Int) -> Int = <func>
> id -1;
stdin:2.5-2.6: type error [M0050], literal of type
  Nat
does not have expected type
  (x : Int) -> Int
> id (-1);
-1 : Int
> -1;
-1 : Int

I must admit, I have a hard time understanding this error:

> id -1;
stdin:2.5-2.6: type error [M0050], literal of type
  Nat
does not have expected type
  (x : Int) -> Int

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants