mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
[FunC] Reserve '!' for the future, identifiers can't start with it
This commit is contained in:
parent
79721d230e
commit
e2467b8ba4
6 changed files with 48 additions and 7 deletions
15
crypto/func/auto-tests/tests/invalid-ident-1.fc
Normal file
15
crypto/func/auto-tests/tests/invalid-ident-1.fc
Normal file
|
@ -0,0 +1,15 @@
|
|||
;; this is allowed, lexer doesn't stop on it
|
||||
int get_false!() { return false; }
|
||||
|
||||
_ main() {
|
||||
var x = false;
|
||||
if (!x) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
{-
|
||||
@compilation_should_fail
|
||||
@stderr '!' is reserved for the future
|
||||
-}
|
11
crypto/func/auto-tests/tests/invalid-ident-2.fc
Normal file
11
crypto/func/auto-tests/tests/invalid-ident-2.fc
Normal file
|
@ -0,0 +1,11 @@
|
|||
_ main() {
|
||||
var x = false;
|
||||
var b = ! x;
|
||||
return b;
|
||||
}
|
||||
|
||||
{-
|
||||
@compilation_should_fail
|
||||
@stderr var b = ! x;
|
||||
@stderr '!' is reserved for the future
|
||||
-}
|
|
@ -1,4 +1,7 @@
|
|||
get slice ascii_slice() {
|
||||
if (false) {
|
||||
return "!string!"; // !string!
|
||||
}
|
||||
return "string";
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ forall X -> (tuple, ()) ~tset(tuple t, int idx, X val) pure asm(t val idx) "SETI
|
|||
|
||||
;; computes 1-acos(x)/Pi by a very simple, extremely slow (~70k gas) and imprecise method
|
||||
;; fixed256 acos_prepare_slow(fixed255 x);
|
||||
int acos_prepare_slow_f255(int x) inline {
|
||||
int acos_prepare_slow_f255!(int x) inline {
|
||||
x -= (x == 0);
|
||||
int t = 1;
|
||||
repeat (255) {
|
||||
|
@ -16,14 +16,14 @@ int acos_prepare_slow_f255(int x) inline {
|
|||
|
||||
;; extremely slow (~70k gas) and somewhat imprecise (very imprecise when x is small), for testing only
|
||||
;; fixed254 acos_slow(fixed255 x);
|
||||
int acos_slow_f255(int x) inline_ref {
|
||||
int t = acos_prepare_slow_f255(x);
|
||||
int acos_slow_f255@(int x) inline_ref {
|
||||
int t = acos_prepare_slow_f255!(x);
|
||||
return - mulrshiftr256(t + (-1 << 256), Pi_const_f254());
|
||||
}
|
||||
|
||||
;; fixed255 asin_slow(fixed255 x);
|
||||
int asin_slow_f255(int x) inline_ref {
|
||||
int t = acos_prepare_slow_f255(abs(x)) % (1 << 255);
|
||||
int asin_slow_f255%(int x) inline_ref {
|
||||
int t = acos_prepare_slow_f255!(abs(x)) % (1 << 255);
|
||||
return muldivr(t, Pi_const_f254(), 1 << 255) * sgn(x);
|
||||
}
|
||||
|
||||
|
@ -116,13 +116,13 @@ int asin_f255_test(x) method_id(10023) {
|
|||
return asin_f255(x);
|
||||
}
|
||||
int asin_slow_f255_test(x) method_id(10024) {
|
||||
return asin_slow_f255(x);
|
||||
return asin_slow_f255%(x);
|
||||
}
|
||||
int acos_f255_test(x) method_id(10025) {
|
||||
return acos_f255(x);
|
||||
}
|
||||
int acos_slow_f255_test(x) method_id(10026) {
|
||||
return acos_slow_f255(x);
|
||||
return acos_slow_f255@(x);
|
||||
}
|
||||
int fixed248::atan_test(x) method_id(10027) {
|
||||
return fixed248::atan(x);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue