@shd101wyy/yo 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +1 -1
- package/README.md +40 -11
- package/out/cjs/index.cjs +14 -14
- package/out/cjs/yo-cli.cjs +453 -403
- package/out/esm/index.mjs +22 -22
- package/out/types/src/codegen/expressions/index.d.ts +0 -1
- package/out/types/src/codegen/utils/index.d.ts +5 -3
- package/out/types/src/env.d.ts +7 -6
- package/out/types/src/error.d.ts +6 -3
- package/out/types/src/evaluator/async/await-analysis-types.d.ts +1 -1
- package/out/types/src/evaluator/builtins/arc_fns.d.ts +20 -0
- package/out/types/src/evaluator/builtins/array_fns.d.ts +8 -0
- package/out/types/src/evaluator/builtins/type_fns.d.ts +2 -2
- package/out/types/src/evaluator/builtins/var_fns.d.ts +1 -1
- package/out/types/src/evaluator/calls/numeric_type.d.ts +4 -0
- package/out/types/src/evaluator/types/utils.d.ts +10 -10
- package/out/types/src/evaluator/utils.d.ts +1 -1
- package/out/types/src/expr.d.ts +9 -4
- package/out/types/src/types/creators.d.ts +1 -1
- package/out/types/src/types/definitions.d.ts +1 -1
- package/out/types/src/types/guards.d.ts +1 -1
- package/out/types/src/types/utils.d.ts +3 -2
- package/out/types/src/utils.d.ts +3 -1
- package/out/types/src/value.d.ts +4 -4
- package/out/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +15 -2
- package/scripts/check-liburing.js +51 -39
- package/std/collections/array_list.yo +2 -2
- package/std/prelude.yo +272 -189
- package/out/types/src/codegen/expressions/array.d.ts +0 -4
- package/out/types/src/evaluator/utils/array-utils.d.ts +0 -15
- package/out/types/src/tests/codegen.test.d.ts +0 -1
- package/out/types/src/tests/module-manager.test.d.ts +0 -1
- package/out/types/src/tests/parser.test.d.ts +0 -1
- package/out/types/src/tests/sample.test.d.ts +0 -0
- package/out/types/src/tests/std.test.d.ts +0 -1
- package/std/monad.yo +0 -152
package/std/prelude.yo
CHANGED
|
@@ -466,11 +466,185 @@ Isolation :: module(
|
|
|
466
466
|
export Isolation;
|
|
467
467
|
|
|
468
468
|
// === Builtin types ===
|
|
469
|
+
/// compt_int
|
|
470
|
+
impl(compt_int, ComptAdd(compt_int)(
|
|
471
|
+
(+) : (fn(compt(lhs): compt_int, compt(rhs): compt_int) -> compt(compt_int))(
|
|
472
|
+
__yo_compt_int_add(lhs, rhs)
|
|
473
|
+
)
|
|
474
|
+
));
|
|
475
|
+
impl(compt_int, ComptSub(compt_int)(
|
|
476
|
+
(-) : (fn(compt(lhs): compt_int, compt(rhs): compt_int) -> compt(compt_int))(
|
|
477
|
+
__yo_compt_int_sub(lhs, rhs)
|
|
478
|
+
)
|
|
479
|
+
));
|
|
480
|
+
impl(compt_int, ComptMul(compt_int)(
|
|
481
|
+
(*) : (fn(compt(lhs): compt_int, compt(rhs): compt_int) -> compt(compt_int))(
|
|
482
|
+
__yo_compt_int_mul(lhs, rhs)
|
|
483
|
+
)
|
|
484
|
+
));
|
|
485
|
+
impl(compt_int, ComptDiv(compt_int)(
|
|
486
|
+
(/) : (fn(compt(lhs): compt_int, compt(rhs): compt_int) -> compt(compt_int))(
|
|
487
|
+
__yo_compt_int_div(lhs, rhs)
|
|
488
|
+
)
|
|
489
|
+
));
|
|
490
|
+
impl(compt_int, ComptMod(compt_int)(
|
|
491
|
+
(%) : (fn(compt(lhs): compt_int, compt(rhs): compt_int) -> compt(compt_int))(
|
|
492
|
+
__yo_compt_int_mod(lhs, rhs)
|
|
493
|
+
)
|
|
494
|
+
));
|
|
495
|
+
impl(compt_int, ComptNegate(compt_int)(
|
|
496
|
+
(neg) : (fn(compt(self): compt_int) -> compt(compt_int))(
|
|
497
|
+
__yo_compt_int_neg(self)
|
|
498
|
+
)
|
|
499
|
+
));
|
|
500
|
+
impl(compt_int, ComptEq(compt_int)(
|
|
501
|
+
(==) : (fn(compt(lhs): compt_int, compt(rhs): compt_int) -> compt(bool))(
|
|
502
|
+
__yo_compt_int_eq(lhs, rhs)
|
|
503
|
+
),
|
|
504
|
+
(!=) : (fn(compt(lhs): compt_int, compt(rhs): compt_int) -> compt(bool))(
|
|
505
|
+
__yo_compt_int_neq(lhs, rhs)
|
|
506
|
+
)
|
|
507
|
+
));
|
|
508
|
+
impl(compt_int, ComptOrd(compt_int)(
|
|
509
|
+
(<) : (fn(compt(lhs): compt_int, compt(rhs): compt_int) -> compt(bool))(
|
|
510
|
+
__yo_compt_int_lt(lhs, rhs)
|
|
511
|
+
),
|
|
512
|
+
(<=) : (fn(compt(lhs): compt_int, compt(rhs): compt_int) -> compt(bool))(
|
|
513
|
+
__yo_compt_int_lte(lhs, rhs)
|
|
514
|
+
),
|
|
515
|
+
(>) : (fn(compt(lhs): compt_int, compt(rhs): compt_int) -> compt(bool))(
|
|
516
|
+
__yo_compt_int_gt(lhs, rhs)
|
|
517
|
+
),
|
|
518
|
+
(>=) : (fn(compt(lhs): compt_int, compt(rhs): compt_int) -> compt(bool))(
|
|
519
|
+
__yo_compt_int_gte(lhs, rhs)
|
|
520
|
+
)
|
|
521
|
+
));
|
|
522
|
+
impl(compt_int, {
|
|
523
|
+
(to_string) :: (fn(compt(self): compt_int) -> compt(compt_string))(
|
|
524
|
+
__yo_compt_int_to_string(self)
|
|
525
|
+
);
|
|
526
|
+
export to_string;
|
|
527
|
+
});
|
|
528
|
+
_compt_int :: compt_int;
|
|
529
|
+
export compt_int : _compt_int;
|
|
530
|
+
|
|
531
|
+
/// compt_float
|
|
532
|
+
impl(compt_float, ComptAdd(compt_float)(
|
|
533
|
+
(+) : (fn(compt(lhs): compt_float, compt(rhs): compt_float) -> compt(compt_float))(
|
|
534
|
+
__yo_compt_float_add(lhs, rhs)
|
|
535
|
+
)
|
|
536
|
+
));
|
|
537
|
+
impl(compt_float, ComptSub(compt_float)(
|
|
538
|
+
(-) : (fn(compt(lhs): compt_float, compt(rhs): compt_float) -> compt(compt_float))(
|
|
539
|
+
__yo_compt_float_sub(lhs, rhs)
|
|
540
|
+
)
|
|
541
|
+
));
|
|
542
|
+
impl(compt_float, ComptMul(compt_float)(
|
|
543
|
+
(*) : (fn(compt(lhs): compt_float, compt(rhs): compt_float) -> compt(compt_float))(
|
|
544
|
+
__yo_compt_float_mul(lhs, rhs)
|
|
545
|
+
)
|
|
546
|
+
));
|
|
547
|
+
impl(compt_float, ComptDiv(compt_float)(
|
|
548
|
+
(/) : (fn(compt(lhs): compt_float, compt(rhs): compt_float) -> compt(compt_float))(
|
|
549
|
+
__yo_compt_float_div(lhs, rhs)
|
|
550
|
+
)
|
|
551
|
+
));
|
|
552
|
+
impl(compt_float, ComptNegate(compt_float)(
|
|
553
|
+
(neg) : (fn(compt(self): compt_float) -> compt(compt_float))(
|
|
554
|
+
__yo_compt_float_neg(self)
|
|
555
|
+
)
|
|
556
|
+
));
|
|
557
|
+
impl(compt_float, ComptEq(compt_float)(
|
|
558
|
+
(==) : (fn(compt(lhs): compt_float, compt(rhs): compt_float) -> compt(bool))(
|
|
559
|
+
__yo_compt_float_eq(lhs, rhs)
|
|
560
|
+
),
|
|
561
|
+
(!=) : (fn(compt(lhs): compt_float, compt(rhs): compt_float) -> compt(bool))(
|
|
562
|
+
__yo_compt_float_neq(lhs, rhs)
|
|
563
|
+
)
|
|
564
|
+
));
|
|
565
|
+
impl(compt_float, ComptOrd(compt_float)(
|
|
566
|
+
(<) : (fn(compt(lhs): compt_float, compt(rhs): compt_float) -> compt(bool))(
|
|
567
|
+
__yo_compt_float_lt(lhs, rhs)
|
|
568
|
+
),
|
|
569
|
+
(<=) : (fn(compt(lhs): compt_float, compt(rhs): compt_float) -> compt(bool))(
|
|
570
|
+
__yo_compt_float_lte(lhs, rhs)
|
|
571
|
+
),
|
|
572
|
+
(>) : (fn(compt(lhs): compt_float, compt(rhs): compt_float) -> compt(bool))(
|
|
573
|
+
__yo_compt_float_gt(lhs, rhs)
|
|
574
|
+
),
|
|
575
|
+
(>=) : (fn(compt(lhs): compt_float, compt(rhs): compt_float) -> compt(bool))(
|
|
576
|
+
__yo_compt_float_gte(lhs, rhs)
|
|
577
|
+
)
|
|
578
|
+
));
|
|
579
|
+
impl(compt_float, {
|
|
580
|
+
(to_string) :: (fn(compt(self): compt_float) -> compt(compt_string))(
|
|
581
|
+
__yo_compt_float_to_string(self)
|
|
582
|
+
);
|
|
583
|
+
export to_string;
|
|
584
|
+
});
|
|
585
|
+
_compt_float :: compt_float;
|
|
586
|
+
export compt_float : _compt_float;
|
|
587
|
+
|
|
588
|
+
/// compt_string
|
|
589
|
+
impl(compt_string, ComptAdd(compt_string)(
|
|
590
|
+
(+) : (fn(compt(lhs): compt_string, compt(rhs): compt_string) -> compt(compt_string))(
|
|
591
|
+
__yo_compt_string_concat(lhs, rhs)
|
|
592
|
+
)
|
|
593
|
+
));
|
|
594
|
+
impl(compt_string, ComptEq(compt_string)(
|
|
595
|
+
(==) : (fn(compt(lhs): compt_string, compt(rhs): compt_string) -> compt(bool))(
|
|
596
|
+
__yo_compt_string_eq(lhs, rhs)
|
|
597
|
+
),
|
|
598
|
+
(!=) : (fn(compt(lhs): compt_string, compt(rhs): compt_string) -> compt(bool))(
|
|
599
|
+
__yo_compt_string_neq(lhs, rhs)
|
|
600
|
+
)
|
|
601
|
+
));
|
|
602
|
+
impl(compt_string, ComptOrd(compt_string)(
|
|
603
|
+
(<) : (fn(compt(lhs): compt_string, compt(rhs): compt_string) -> compt(bool))(
|
|
604
|
+
__yo_compt_string_lt(lhs, rhs)
|
|
605
|
+
),
|
|
606
|
+
(<=) : (fn(compt(lhs): compt_string, compt(rhs): compt_string) -> compt(bool))(
|
|
607
|
+
__yo_compt_string_lte(lhs, rhs)
|
|
608
|
+
),
|
|
609
|
+
(>) : (fn(compt(lhs): compt_string, compt(rhs): compt_string) -> compt(bool))(
|
|
610
|
+
__yo_compt_string_gt(lhs, rhs)
|
|
611
|
+
),
|
|
612
|
+
(>=) : (fn(compt(lhs): compt_string, compt(rhs): compt_string) -> compt(bool))(
|
|
613
|
+
__yo_compt_string_gte(lhs, rhs)
|
|
614
|
+
)
|
|
615
|
+
));
|
|
616
|
+
impl(compt_string, {
|
|
617
|
+
len :: (fn(compt(self): compt_string) -> compt(compt_int))(
|
|
618
|
+
__yo_compt_string_length(self)
|
|
619
|
+
);
|
|
620
|
+
export len;
|
|
621
|
+
|
|
622
|
+
(to_upper) :: (fn(compt(self): compt_string) -> compt(compt_string))(
|
|
623
|
+
__yo_compt_string_to_upper(self)
|
|
624
|
+
);
|
|
625
|
+
export to_upper;
|
|
626
|
+
|
|
627
|
+
(to_lower) :: (fn(compt(self): compt_string) -> compt(compt_string))(
|
|
628
|
+
__yo_compt_string_to_lower(self)
|
|
629
|
+
);
|
|
630
|
+
export to_lower;
|
|
631
|
+
|
|
632
|
+
slice :: (fn(compt(self): compt_string, compt(start): compt_int, compt(end): compt_int) -> compt(compt_string))(
|
|
633
|
+
__yo_compt_string_slice(self, start, end)
|
|
634
|
+
);
|
|
635
|
+
export slice;
|
|
636
|
+
});
|
|
637
|
+
_compt_string :: compt_string;
|
|
638
|
+
export compt_string : _compt_string;
|
|
639
|
+
|
|
469
640
|
/// bool
|
|
470
641
|
impl(bool, Send());
|
|
471
642
|
impl(bool, Eq(bool)(
|
|
472
|
-
(==): ((a, b) ->
|
|
643
|
+
(==) : ((a, b) ->
|
|
473
644
|
__yo_op_eq(a, b)
|
|
645
|
+
),
|
|
646
|
+
(!=) : ((a, b) ->
|
|
647
|
+
__yo_op_neq(a, b)
|
|
474
648
|
)
|
|
475
649
|
));
|
|
476
650
|
impl(bool, Clone(bool)(
|
|
@@ -489,6 +663,9 @@ impl(bool, Hash(
|
|
|
489
663
|
impl(bool, ComptEq(bool)(
|
|
490
664
|
(==) : (fn(compt(lhs): bool, compt(rhs): bool) -> compt(bool))(
|
|
491
665
|
__yo_compt_boolean_eq(lhs, rhs)
|
|
666
|
+
),
|
|
667
|
+
(!=) : (fn(compt(lhs): bool, compt(rhs): bool) -> compt(bool))(
|
|
668
|
+
__yo_compt_boolean_neq(lhs, rhs)
|
|
492
669
|
)
|
|
493
670
|
));
|
|
494
671
|
impl(bool, {
|
|
@@ -501,6 +678,11 @@ _boolean :: bool;
|
|
|
501
678
|
export bool : _boolean;
|
|
502
679
|
|
|
503
680
|
/// i8
|
|
681
|
+
impl(i8, {
|
|
682
|
+
MIN :: i8(-128);
|
|
683
|
+
MAX :: i8(127);
|
|
684
|
+
export MIN, MAX;
|
|
685
|
+
});
|
|
504
686
|
impl(i8, Send());
|
|
505
687
|
impl(i8, Add(i8)(
|
|
506
688
|
(+): ((a, b) -> __yo_op_add(a, b))
|
|
@@ -619,6 +801,11 @@ _i8 :: i8;
|
|
|
619
801
|
export i8 : _i8;
|
|
620
802
|
|
|
621
803
|
/// i16
|
|
804
|
+
impl(i16, {
|
|
805
|
+
MIN :: i16(-32768);
|
|
806
|
+
MAX :: i16(32767);
|
|
807
|
+
export MIN, MAX;
|
|
808
|
+
});
|
|
622
809
|
impl(i16, Send());
|
|
623
810
|
impl(i16, Add(i16)(
|
|
624
811
|
(+): ((a, b) -> __yo_op_add(a, b))
|
|
@@ -737,6 +924,11 @@ _i16 :: i16;
|
|
|
737
924
|
export i16 : _i16;
|
|
738
925
|
|
|
739
926
|
/// i32
|
|
927
|
+
impl(i32, {
|
|
928
|
+
MIN :: i32(-2147483648);
|
|
929
|
+
MAX :: i32(2147483647);
|
|
930
|
+
export MIN, MAX;
|
|
931
|
+
});
|
|
740
932
|
impl(i32, Send());
|
|
741
933
|
impl(i32, Add(i32)(
|
|
742
934
|
(+): ((a, b) -> __yo_op_add(a, b))
|
|
@@ -860,6 +1052,11 @@ _i32 :: i32;
|
|
|
860
1052
|
export i32 : _i32;
|
|
861
1053
|
|
|
862
1054
|
/// i64
|
|
1055
|
+
impl(i64, {
|
|
1056
|
+
MIN :: i64(-9223372036854775808);
|
|
1057
|
+
MAX :: i64(9223372036854775807);
|
|
1058
|
+
export MIN, MAX;
|
|
1059
|
+
});
|
|
863
1060
|
impl(i64, Send());
|
|
864
1061
|
impl(i64, Add(i64)(
|
|
865
1062
|
(+): ((a, b) -> __yo_op_add(a, b))
|
|
@@ -978,6 +1175,11 @@ _i64 :: i64;
|
|
|
978
1175
|
export i64 : _i64;
|
|
979
1176
|
|
|
980
1177
|
/// u8
|
|
1178
|
+
impl(u8, {
|
|
1179
|
+
MIN :: u8(0);
|
|
1180
|
+
MAX :: u8(255);
|
|
1181
|
+
export MIN, MAX;
|
|
1182
|
+
});
|
|
981
1183
|
impl(u8, Send());
|
|
982
1184
|
impl(u8, Add(u8)(
|
|
983
1185
|
(+): ((a, b) -> __yo_op_add(a, b))
|
|
@@ -1091,6 +1293,11 @@ _u8 :: u8;
|
|
|
1091
1293
|
export u8 : _u8;
|
|
1092
1294
|
|
|
1093
1295
|
/// u16
|
|
1296
|
+
impl(u16, {
|
|
1297
|
+
MIN :: u16(0);
|
|
1298
|
+
MAX :: u16(65535);
|
|
1299
|
+
export MIN, MAX;
|
|
1300
|
+
});
|
|
1094
1301
|
impl(u16, Send());
|
|
1095
1302
|
impl(u16, Add(u16)(
|
|
1096
1303
|
(+): ((a, b) -> __yo_op_add(a, b))
|
|
@@ -1204,6 +1411,11 @@ _u16 :: u16;
|
|
|
1204
1411
|
export u16 : _u16;
|
|
1205
1412
|
|
|
1206
1413
|
/// u32
|
|
1414
|
+
impl(u32, {
|
|
1415
|
+
MIN :: u32(0);
|
|
1416
|
+
MAX :: u32(4294967295);
|
|
1417
|
+
export MIN, MAX;
|
|
1418
|
+
});
|
|
1207
1419
|
impl(u32, Send());
|
|
1208
1420
|
impl(u32, Add(u32)(
|
|
1209
1421
|
(+): ((a, b) -> __yo_op_add(a, b))
|
|
@@ -1317,6 +1529,11 @@ _u32 :: u32;
|
|
|
1317
1529
|
export u32 : _u32;
|
|
1318
1530
|
|
|
1319
1531
|
/// u64
|
|
1532
|
+
impl(u64, {
|
|
1533
|
+
MIN :: u64(0);
|
|
1534
|
+
MAX :: u64(18446744073709551615);
|
|
1535
|
+
export MIN, MAX;
|
|
1536
|
+
});
|
|
1320
1537
|
impl(u64, Send());
|
|
1321
1538
|
impl(u64, Add(u64)(
|
|
1322
1539
|
(+): ((a, b) -> __yo_op_add(a, b))
|
|
@@ -1644,6 +1861,11 @@ _f64 :: f64;
|
|
|
1644
1861
|
export f64 : _f64;
|
|
1645
1862
|
|
|
1646
1863
|
/// isize
|
|
1864
|
+
impl(isize, {
|
|
1865
|
+
MIN :: isize(-9223372036854775808);
|
|
1866
|
+
MAX :: isize(9223372036854775807);
|
|
1867
|
+
export MIN, MAX;
|
|
1868
|
+
});
|
|
1647
1869
|
impl(isize, Send());
|
|
1648
1870
|
impl(isize, Add(isize)(
|
|
1649
1871
|
(+): ((a, b) -> __yo_op_add(a, b))
|
|
@@ -1762,6 +1984,11 @@ _isize :: isize;
|
|
|
1762
1984
|
export isize : _isize;
|
|
1763
1985
|
|
|
1764
1986
|
/// usize
|
|
1987
|
+
impl(usize, {
|
|
1988
|
+
MIN :: usize(0);
|
|
1989
|
+
MAX :: usize(18446744073709551615);
|
|
1990
|
+
export MIN, MAX;
|
|
1991
|
+
});
|
|
1765
1992
|
impl(usize, Send());
|
|
1766
1993
|
impl(usize, Add(usize)(
|
|
1767
1994
|
(+): ((a, b) -> __yo_op_add(a, b))
|
|
@@ -2415,178 +2642,6 @@ impl(longdouble, Clone(longdouble)(
|
|
|
2415
2642
|
_longdouble :: longdouble;
|
|
2416
2643
|
export longdouble : _longdouble;
|
|
2417
2644
|
|
|
2418
|
-
|
|
2419
|
-
/// compt_int
|
|
2420
|
-
impl(compt_int, ComptAdd(compt_int)(
|
|
2421
|
-
(+) : (fn(compt(lhs): compt_int, compt(rhs): compt_int) -> compt(compt_int))(
|
|
2422
|
-
__yo_compt_int_add(lhs, rhs)
|
|
2423
|
-
)
|
|
2424
|
-
));
|
|
2425
|
-
impl(compt_int, ComptSub(compt_int)(
|
|
2426
|
-
(-) : (fn(compt(lhs): compt_int, compt(rhs): compt_int) -> compt(compt_int))(
|
|
2427
|
-
__yo_compt_int_sub(lhs, rhs)
|
|
2428
|
-
)
|
|
2429
|
-
));
|
|
2430
|
-
impl(compt_int, ComptMul(compt_int)(
|
|
2431
|
-
(*) : (fn(compt(lhs): compt_int, compt(rhs): compt_int) -> compt(compt_int))(
|
|
2432
|
-
__yo_compt_int_mul(lhs, rhs)
|
|
2433
|
-
)
|
|
2434
|
-
));
|
|
2435
|
-
impl(compt_int, ComptDiv(compt_int)(
|
|
2436
|
-
(/) : (fn(compt(lhs): compt_int, compt(rhs): compt_int) -> compt(compt_int))(
|
|
2437
|
-
__yo_compt_int_div(lhs, rhs)
|
|
2438
|
-
)
|
|
2439
|
-
));
|
|
2440
|
-
impl(compt_int, ComptMod(compt_int)(
|
|
2441
|
-
(%) : (fn(compt(lhs): compt_int, compt(rhs): compt_int) -> compt(compt_int))(
|
|
2442
|
-
__yo_compt_int_mod(lhs, rhs)
|
|
2443
|
-
)
|
|
2444
|
-
));
|
|
2445
|
-
impl(compt_int, ComptNegate(compt_int)(
|
|
2446
|
-
(neg) : (fn(compt(self): compt_int) -> compt(compt_int))(
|
|
2447
|
-
__yo_compt_int_neg(self)
|
|
2448
|
-
)
|
|
2449
|
-
));
|
|
2450
|
-
impl(compt_int, ComptEq(compt_int)(
|
|
2451
|
-
(==) : (fn(compt(lhs): compt_int, compt(rhs): compt_int) -> compt(bool))(
|
|
2452
|
-
__yo_compt_int_eq(lhs, rhs)
|
|
2453
|
-
),
|
|
2454
|
-
(!=) : (fn(compt(lhs): compt_int, compt(rhs): compt_int) -> compt(bool))(
|
|
2455
|
-
__yo_compt_int_neq(lhs, rhs)
|
|
2456
|
-
)
|
|
2457
|
-
));
|
|
2458
|
-
impl(compt_int, ComptOrd(compt_int)(
|
|
2459
|
-
(<) : (fn(compt(lhs): compt_int, compt(rhs): compt_int) -> compt(bool))(
|
|
2460
|
-
__yo_compt_int_lt(lhs, rhs)
|
|
2461
|
-
),
|
|
2462
|
-
(<=) : (fn(compt(lhs): compt_int, compt(rhs): compt_int) -> compt(bool))(
|
|
2463
|
-
__yo_compt_int_lte(lhs, rhs)
|
|
2464
|
-
),
|
|
2465
|
-
(>) : (fn(compt(lhs): compt_int, compt(rhs): compt_int) -> compt(bool))(
|
|
2466
|
-
__yo_compt_int_gt(lhs, rhs)
|
|
2467
|
-
),
|
|
2468
|
-
(>=) : (fn(compt(lhs): compt_int, compt(rhs): compt_int) -> compt(bool))(
|
|
2469
|
-
__yo_compt_int_gte(lhs, rhs)
|
|
2470
|
-
)
|
|
2471
|
-
));
|
|
2472
|
-
impl(compt_int, {
|
|
2473
|
-
(to_string) :: (fn(compt(self): compt_int) -> compt(compt_string))(
|
|
2474
|
-
__yo_compt_int_to_string(self)
|
|
2475
|
-
);
|
|
2476
|
-
export to_string;
|
|
2477
|
-
});
|
|
2478
|
-
_compt_int :: compt_int;
|
|
2479
|
-
export compt_int : _compt_int;
|
|
2480
|
-
|
|
2481
|
-
/// compt_float
|
|
2482
|
-
impl(compt_float, ComptAdd(compt_float)(
|
|
2483
|
-
(+) : (fn(compt(lhs): compt_float, compt(rhs): compt_float) -> compt(compt_float))(
|
|
2484
|
-
__yo_compt_float_add(lhs, rhs)
|
|
2485
|
-
)
|
|
2486
|
-
));
|
|
2487
|
-
impl(compt_float, ComptSub(compt_float)(
|
|
2488
|
-
(-) : (fn(compt(lhs): compt_float, compt(rhs): compt_float) -> compt(compt_float))(
|
|
2489
|
-
__yo_compt_float_sub(lhs, rhs)
|
|
2490
|
-
)
|
|
2491
|
-
));
|
|
2492
|
-
impl(compt_float, ComptMul(compt_float)(
|
|
2493
|
-
(*) : (fn(compt(lhs): compt_float, compt(rhs): compt_float) -> compt(compt_float))(
|
|
2494
|
-
__yo_compt_float_mul(lhs, rhs)
|
|
2495
|
-
)
|
|
2496
|
-
));
|
|
2497
|
-
impl(compt_float, ComptDiv(compt_float)(
|
|
2498
|
-
(/) : (fn(compt(lhs): compt_float, compt(rhs): compt_float) -> compt(compt_float))(
|
|
2499
|
-
__yo_compt_float_div(lhs, rhs)
|
|
2500
|
-
)
|
|
2501
|
-
));
|
|
2502
|
-
impl(compt_float, ComptNegate(compt_float)(
|
|
2503
|
-
(neg) : (fn(compt(self): compt_float) -> compt(compt_float))(
|
|
2504
|
-
__yo_compt_float_neg(self)
|
|
2505
|
-
)
|
|
2506
|
-
));
|
|
2507
|
-
impl(compt_float, ComptEq(compt_float)(
|
|
2508
|
-
(==) : (fn(compt(lhs): compt_float, compt(rhs): compt_float) -> compt(bool))(
|
|
2509
|
-
__yo_compt_float_eq(lhs, rhs)
|
|
2510
|
-
),
|
|
2511
|
-
(!=) : (fn(compt(lhs): compt_float, compt(rhs): compt_float) -> compt(bool))(
|
|
2512
|
-
__yo_compt_float_neq(lhs, rhs)
|
|
2513
|
-
)
|
|
2514
|
-
));
|
|
2515
|
-
impl(compt_float, ComptOrd(compt_float)(
|
|
2516
|
-
(<) : (fn(compt(lhs): compt_float, compt(rhs): compt_float) -> compt(bool))(
|
|
2517
|
-
__yo_compt_float_lt(lhs, rhs)
|
|
2518
|
-
),
|
|
2519
|
-
(<=) : (fn(compt(lhs): compt_float, compt(rhs): compt_float) -> compt(bool))(
|
|
2520
|
-
__yo_compt_float_lte(lhs, rhs)
|
|
2521
|
-
),
|
|
2522
|
-
(>) : (fn(compt(lhs): compt_float, compt(rhs): compt_float) -> compt(bool))(
|
|
2523
|
-
__yo_compt_float_gt(lhs, rhs)
|
|
2524
|
-
),
|
|
2525
|
-
(>=) : (fn(compt(lhs): compt_float, compt(rhs): compt_float) -> compt(bool))(
|
|
2526
|
-
__yo_compt_float_gte(lhs, rhs)
|
|
2527
|
-
)
|
|
2528
|
-
));
|
|
2529
|
-
impl(compt_float, {
|
|
2530
|
-
(to_string) :: (fn(compt(self): compt_float) -> compt(compt_string))(
|
|
2531
|
-
__yo_compt_float_to_string(self)
|
|
2532
|
-
);
|
|
2533
|
-
export to_string;
|
|
2534
|
-
});
|
|
2535
|
-
_compt_float :: compt_float;
|
|
2536
|
-
export compt_float : _compt_float;
|
|
2537
|
-
|
|
2538
|
-
/// compt_string
|
|
2539
|
-
impl(compt_string, ComptAdd(compt_string)(
|
|
2540
|
-
(+) : (fn(compt(lhs): compt_string, compt(rhs): compt_string) -> compt(compt_string))(
|
|
2541
|
-
__yo_compt_string_concat(lhs, rhs)
|
|
2542
|
-
)
|
|
2543
|
-
));
|
|
2544
|
-
impl(compt_string, ComptEq(compt_string)(
|
|
2545
|
-
(==) : (fn(compt(lhs): compt_string, compt(rhs): compt_string) -> compt(bool))(
|
|
2546
|
-
__yo_compt_string_eq(lhs, rhs)
|
|
2547
|
-
),
|
|
2548
|
-
(!=) : (fn(compt(lhs): compt_string, compt(rhs): compt_string) -> compt(bool))(
|
|
2549
|
-
__yo_compt_string_neq(lhs, rhs)
|
|
2550
|
-
)
|
|
2551
|
-
));
|
|
2552
|
-
impl(compt_string, ComptOrd(compt_string)(
|
|
2553
|
-
(<) : (fn(compt(lhs): compt_string, compt(rhs): compt_string) -> compt(bool))(
|
|
2554
|
-
__yo_compt_string_lt(lhs, rhs)
|
|
2555
|
-
),
|
|
2556
|
-
(<=) : (fn(compt(lhs): compt_string, compt(rhs): compt_string) -> compt(bool))(
|
|
2557
|
-
__yo_compt_string_lte(lhs, rhs)
|
|
2558
|
-
),
|
|
2559
|
-
(>) : (fn(compt(lhs): compt_string, compt(rhs): compt_string) -> compt(bool))(
|
|
2560
|
-
__yo_compt_string_gt(lhs, rhs)
|
|
2561
|
-
),
|
|
2562
|
-
(>=) : (fn(compt(lhs): compt_string, compt(rhs): compt_string) -> compt(bool))(
|
|
2563
|
-
__yo_compt_string_gte(lhs, rhs)
|
|
2564
|
-
)
|
|
2565
|
-
));
|
|
2566
|
-
impl(compt_string, {
|
|
2567
|
-
len :: (fn(compt(self): compt_string) -> compt(compt_int))(
|
|
2568
|
-
__yo_compt_string_length(self)
|
|
2569
|
-
);
|
|
2570
|
-
export len;
|
|
2571
|
-
|
|
2572
|
-
(to_upper) :: (fn(compt(self): compt_string) -> compt(compt_string))(
|
|
2573
|
-
__yo_compt_string_to_upper(self)
|
|
2574
|
-
);
|
|
2575
|
-
export to_upper;
|
|
2576
|
-
|
|
2577
|
-
(to_lower) :: (fn(compt(self): compt_string) -> compt(compt_string))(
|
|
2578
|
-
__yo_compt_string_to_lower(self)
|
|
2579
|
-
);
|
|
2580
|
-
export to_lower;
|
|
2581
|
-
|
|
2582
|
-
slice :: (fn(compt(self): compt_string, compt(start): compt_int, compt(end): compt_int) -> compt(compt_string))(
|
|
2583
|
-
__yo_compt_string_slice(self, start, end)
|
|
2584
|
-
);
|
|
2585
|
-
export slice;
|
|
2586
|
-
});
|
|
2587
|
-
_compt_string :: compt_string;
|
|
2588
|
-
export compt_string : _compt_string;
|
|
2589
|
-
|
|
2590
2645
|
/// Ptr
|
|
2591
2646
|
impl(forall(T : Type), where(T <: Send), *(T), Send());
|
|
2592
2647
|
/*
|
|
@@ -2654,8 +2709,22 @@ impl(forall(T : Type, U : usize), Array(T, U), {
|
|
|
2654
2709
|
len :: (fn(self : *(Self)) -> usize) {
|
|
2655
2710
|
return U;
|
|
2656
2711
|
};
|
|
2657
|
-
|
|
2658
2712
|
export len;
|
|
2713
|
+
|
|
2714
|
+
fill :: (fn(compt(val) : T) -> compt(Self)) {
|
|
2715
|
+
return __yo_array_fill(Self, val);
|
|
2716
|
+
};
|
|
2717
|
+
export fill;
|
|
2718
|
+
|
|
2719
|
+
/*
|
|
2720
|
+
// NOTE: Macro doesn't work yet.
|
|
2721
|
+
fill :: (fn(quote(val) : Expr) -> unquote(Expr)) {
|
|
2722
|
+
return quote(
|
|
2723
|
+
__yo_array_fill(Self, unquote(val))
|
|
2724
|
+
);
|
|
2725
|
+
};
|
|
2726
|
+
export fill;
|
|
2727
|
+
*/
|
|
2659
2728
|
});
|
|
2660
2729
|
|
|
2661
2730
|
/// Slice
|
|
@@ -2741,15 +2810,15 @@ impl(Type, {
|
|
|
2741
2810
|
});
|
|
2742
2811
|
export is_compatible_with;
|
|
2743
2812
|
|
|
2744
|
-
|
|
2745
|
-
return
|
|
2813
|
+
contains_rc_type :: (fn(compt(self): Type) -> compt(bool))({
|
|
2814
|
+
return __yo_type_contains_rc_type(self);
|
|
2746
2815
|
});
|
|
2747
|
-
export
|
|
2816
|
+
export contains_rc_type;
|
|
2748
2817
|
|
|
2749
|
-
|
|
2750
|
-
return
|
|
2818
|
+
can_form_rc_cycle :: (fn(compt(self): Type) -> compt(bool))({
|
|
2819
|
+
return __yo_type_can_form_rc_cycle(self);
|
|
2751
2820
|
});
|
|
2752
|
-
export
|
|
2821
|
+
export can_form_rc_cycle;
|
|
2753
2822
|
|
|
2754
2823
|
impls :: (fn(compt(self): Type, compt(marker): Module) -> compt(bool))({
|
|
2755
2824
|
return __yo_type_impls(self, marker);
|
|
@@ -2768,10 +2837,10 @@ Var :: impl({
|
|
|
2768
2837
|
};
|
|
2769
2838
|
export print_info;
|
|
2770
2839
|
|
|
2771
|
-
|
|
2772
|
-
return quote
|
|
2840
|
+
is_owning_the_rc_value :: (fn(quote(variable) : Expr) -> unquote(Expr)) {
|
|
2841
|
+
return quote __yo_var_is_owning_the_rc_value(unquote(variable));
|
|
2773
2842
|
};
|
|
2774
|
-
export
|
|
2843
|
+
export is_owning_the_rc_value;
|
|
2775
2844
|
|
|
2776
2845
|
has_other_aliases :: (fn(quote(variable) : Expr) -> unquote(Expr)) {
|
|
2777
2846
|
return quote __yo_var_has_other_aliases(unquote(variable));
|
|
@@ -2859,7 +2928,7 @@ Box :: (fn(compt(V) : Type) -> compt(Type))
|
|
|
2859
2928
|
(*) : V
|
|
2860
2929
|
)
|
|
2861
2930
|
;
|
|
2862
|
-
box :: (fn(forall(V : Type), value : V) -> Box(V))
|
|
2931
|
+
box :: (fn(forall(V : Type), own(value) : V) -> Box(V))
|
|
2863
2932
|
Box(V)(value)
|
|
2864
2933
|
;
|
|
2865
2934
|
impl(forall(T : Type), Box(T), Isolation(
|
|
@@ -2894,14 +2963,14 @@ impl(forall(T : Type), Iso(T), {
|
|
|
2894
2963
|
unquote(assignment);
|
|
2895
2964
|
unquote(temp_type) :: typeof(unquote(temp));
|
|
2896
2965
|
cond(
|
|
2897
|
-
Type.
|
|
2966
|
+
Type.contains_rc_type(unquote(temp_type)) => // compile-time check
|
|
2898
2967
|
cond(
|
|
2899
|
-
Type.
|
|
2968
|
+
Type.can_form_rc_cycle(unquote(temp_type)) => { // compile-time check
|
|
2900
2969
|
consume(unquote(temp));
|
|
2901
|
-
compt_assert(false, "Cannot isolate value of type containing
|
|
2970
|
+
compt_assert(false, "Cannot isolate value of type containing Rc type that can form cycles");
|
|
2902
2971
|
Option(Iso(unquote(temp_type))).None
|
|
2903
2972
|
},
|
|
2904
|
-
!(Var.
|
|
2973
|
+
!(Var.is_owning_the_rc_value(unquote(temp))) => { // compile-time check
|
|
2905
2974
|
consume(unquote(temp));
|
|
2906
2975
|
compt_assert(false, "Cannot isolate value of type that is not owned");
|
|
2907
2976
|
Option(Iso(unquote(temp_type))).None
|
|
@@ -2919,7 +2988,7 @@ impl(forall(T : Type), Iso(T), {
|
|
|
2919
2988
|
}
|
|
2920
2989
|
),
|
|
2921
2990
|
true => { // compile-time check
|
|
2922
|
-
compt_assert(false, "Cannot isolate value type that does not contain
|
|
2991
|
+
compt_assert(false, "Cannot isolate value type that does not contain Rc type");
|
|
2923
2992
|
Option(Iso(unquote(temp_type))).Some(Iso(unquote(temp_type))(unquote(temp)))
|
|
2924
2993
|
}
|
|
2925
2994
|
)
|
|
@@ -2953,6 +3022,20 @@ MaybeUninit :: (fn(compt(BaseType): Type) -> compt(Type))
|
|
|
2953
3022
|
)
|
|
2954
3023
|
;
|
|
2955
3024
|
|
|
3025
|
+
/* EXAMPLE:
|
|
3026
|
+
|
|
3027
|
+
extern "C",
|
|
3028
|
+
time_t : Type,
|
|
3029
|
+
time :
|
|
3030
|
+
fn(timer: ?*(time_t)) -> time_t
|
|
3031
|
+
;
|
|
3032
|
+
|
|
3033
|
+
uninitialized_timer := MaybeUninit(time_t).new(); // Create an uninitialized MaybeUninit(time_t)
|
|
3034
|
+
ptr := uninitialized_timer.as_ptr(); // ptr has type *(time_t)
|
|
3035
|
+
time(.Some(ptr)); // initialize the timer
|
|
3036
|
+
timer := uninitialized_timer.assume_init(); // now we can assume it's initialized
|
|
3037
|
+
|
|
3038
|
+
*/
|
|
2956
3039
|
export
|
|
2957
3040
|
MaybeUninit
|
|
2958
3041
|
;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { FuncCallExpr } from "../../expr";
|
|
2
|
-
import { CodeGenContext } from "../utils";
|
|
3
|
-
export declare function isArrayFillMethodCall(expr: FuncCallExpr): boolean;
|
|
4
|
-
export declare function generateArrayFillCall(expr: FuncCallExpr, indent: string, context: CodeGenContext): string;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Environment } from "../../env";
|
|
2
|
-
import { Expr, FuncCallExpr } from "../../expr";
|
|
3
|
-
import { ArrayType } from "../../types";
|
|
4
|
-
import { EvaluatorContext } from "../context";
|
|
5
|
-
export declare function evaluateArrayFillMethod({ expr, arrayType, fillValueArg, env, context, }: {
|
|
6
|
-
expr: FuncCallExpr;
|
|
7
|
-
arrayType: ArrayType;
|
|
8
|
-
fillValueArg: Expr;
|
|
9
|
-
env: Environment;
|
|
10
|
-
context: EvaluatorContext;
|
|
11
|
-
}): {
|
|
12
|
-
expr: FuncCallExpr;
|
|
13
|
-
env: Environment;
|
|
14
|
-
};
|
|
15
|
-
export declare function isArrayTypeFillMethodCall(receiverArg: Expr, methodExpr: Expr): boolean;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|