@@ -2585,6 +2585,26 @@ var ErrorCreatorMap = map[string]ErrorCreator{
2585
2585
},
2586
2586
},
2587
2587
2588
+ "vm/cast/a" : {
2589
+ Message : func (tok * token.Token , args ... any ) string {
2590
+ return "unable to perform cast"
2591
+ },
2592
+ Explanation : func (errors Errors , pos int , tok * token.Token , args ... any ) string {
2593
+ return "Types can only be cast between clones of the same parent, or the " +
2594
+ "parent itself."
2595
+ },
2596
+ },
2597
+
2598
+ "vm/cast/b" : {
2599
+ Message : func (tok * token.Token , args ... any ) string {
2600
+ return "unable to perform cast"
2601
+ },
2602
+ Explanation : func (errors Errors , pos int , tok * token.Token , args ... any ) string {
2603
+ return "Types can only be cast between clones of the same parent, or the " +
2604
+ "parent itself."
2605
+ },
2606
+ },
2607
+
2588
2608
"vm/div/float" : {
2589
2609
Message : func (tok * token.Token , args ... any ) string {
2590
2610
return "division by zero"
@@ -2603,6 +2623,71 @@ var ErrorCreatorMap = map[string]ErrorCreator{
2603
2623
},
2604
2624
},
2605
2625
2626
+ "vm/for/type/a" : {
2627
+ Message : func (tok * token.Token , args ... any ) string {
2628
+ return "can't range over given type"
2629
+ },
2630
+ Explanation : func (errors Errors , pos int , tok * token.Token , args ... any ) string {
2631
+ return "You can range over lists, strings, maps, sets, and enums."
2632
+ },
2633
+ },
2634
+
2635
+ "vm/for/type/b" : {
2636
+ Message : func (tok * token.Token , args ... any ) string {
2637
+ return "can't range over given type"
2638
+ },
2639
+ Explanation : func (errors Errors , pos int , tok * token.Token , args ... any ) string {
2640
+ return "You can range over lists, strings, maps, sets, and enums."
2641
+ },
2642
+ },
2643
+
2644
+ "vm/for/type/c" : {
2645
+ Message : func (tok * token.Token , args ... any ) string {
2646
+ return "can't range over given type"
2647
+ },
2648
+ Explanation : func (errors Errors , pos int , tok * token.Token , args ... any ) string {
2649
+ return "You can range over lists, strings, maps, sets, and enums."
2650
+ },
2651
+ },
2652
+
2653
+ "vm/for/pair" : {
2654
+ Message : func (tok * token.Token , args ... any ) string {
2655
+ return "range should be pair of integers"
2656
+ },
2657
+ Explanation : func (errors Errors , pos int , tok * token.Token , args ... any ) string {
2658
+ return "If you're going to give the range of a list using `::`, the elements of the pair should both be integers."
2659
+ },
2660
+ },
2661
+
2662
+ "vm/func/args" : {
2663
+ Message : func (tok * token.Token , args ... any ) string {
2664
+ return "lambda function has the wrong number of arguments"
2665
+ },
2666
+ Explanation : func (errors Errors , pos int , tok * token.Token , args ... any ) string {
2667
+ return "The arguments passed are different in number from the parameters of the function."
2668
+ },
2669
+ },
2670
+
2671
+ "vm/func/go" : {
2672
+ Message : func (tok * token.Token , args ... any ) string {
2673
+ return "failed to convert Pipefish value"
2674
+ },
2675
+ Explanation : func (errors Errors , pos int , tok * token.Token , args ... any ) string {
2676
+ return "You're trying to apply a Go lambda function (wrapped in a Pipefish " +
2677
+ "lambda function), to something that Pipefish doesn't know how to convert " +
2678
+ "into Go."
2679
+ },
2680
+ },
2681
+
2682
+ "vm/func/types" : {
2683
+ Message : func (tok * token.Token , args ... any ) string {
2684
+ return "function has the wrong types"
2685
+ },
2686
+ Explanation : func (errors Errors , pos int , tok * token.Token , args ... any ) string {
2687
+ return "The arguments passed are different in type from the parameters of the function."
2688
+ },
2689
+ },
2690
+
2606
2691
"vm/go/type" : {
2607
2692
Message : func (tok * token.Token , args ... any ) string {
2608
2693
return "can't convert Go value of type " + emph (args [0 ]) + " to Pipefish"
@@ -2819,6 +2904,15 @@ var ErrorCreatorMap = map[string]ErrorCreator{
2819
2904
},
2820
2905
},
2821
2906
2907
+ "vm/index/q" : {
2908
+ Message : func (tok * token.Token , args ... any ) string {
2909
+ return fmt .Sprintf ("out of range: can't index value of type %v by %v" , emph (args [0 ]), emph (args [1 ]))
2910
+ },
2911
+ Explanation : func (errors Errors , pos int , tok * token.Token , args ... any ) string {
2912
+ return fmt .Sprintf ("Pipefish just can't make sense of that at all." )
2913
+ },
2914
+ },
2915
+
2822
2916
"vm/label/exist" : {
2823
2917
Message : func (tok * token.Token , args ... any ) string {
2824
2918
return fmt .Sprintf ("can't convert string %v to a label" , emphStr (args [0 ]))
@@ -2846,6 +2940,16 @@ var ErrorCreatorMap = map[string]ErrorCreator{
2846
2940
},
2847
2941
},
2848
2942
2943
+ "vm/mf/lhs" : {
2944
+ Message : func (tok * token.Token , args ... any ) string {
2945
+ return "expected value of type 'list'"
2946
+ },
2947
+ Explanation : func (errors Errors , pos int , tok * token.Token , args ... any ) string {
2948
+ return "The value on the left-hand side of the operators '?>' and '>>' " +
2949
+ "should always be of type 'list'."
2950
+ },
2951
+ },
2952
+
2849
2953
"vm/mod/int" : {
2850
2954
Message : func (tok * token.Token , args ... any ) string {
2851
2955
return "taking the modulus of a number by zero"
@@ -2855,6 +2959,15 @@ var ErrorCreatorMap = map[string]ErrorCreator{
2855
2959
},
2856
2960
},
2857
2961
2962
+ "vm/oopsie" : {
2963
+ Message : func (tok * token.Token , args ... any ) string {
2964
+ return "something unexpected has gone wrong"
2965
+ },
2966
+ Explanation : func (errors Errors , pos int , tok * token.Token , args ... any ) string {
2967
+ return "Please tell the author of Pipefish that he messed up. Thank you."
2968
+ },
2969
+ },
2970
+
2858
2971
"vm/pipe/filter/bool" : {
2859
2972
Message : func (tok * token.Token , args ... any ) string {
2860
2973
return "right-hand side of filter expression cannot return boolean"
@@ -3017,6 +3130,43 @@ var ErrorCreatorMap = map[string]ErrorCreator{
3017
3130
},
3018
3131
},
3019
3132
3133
+ "vm/splat/type" : {
3134
+ Message : func (tok * token.Token , args ... any ) string {
3135
+ return "expected value of type 'list'"
3136
+ },
3137
+ Explanation : func (errors Errors , pos int , tok * token.Token , args ... any ) string {
3138
+ return "The value on the left-hand side of the splat operator '...' " +
3139
+ "should always be of type 'list'."
3140
+ },
3141
+ },
3142
+
3143
+ "vm/tup/first" : {
3144
+ Message : func (tok * token.Token , args ... any ) string {
3145
+ return "trying to take the first element of an empty tuple"
3146
+ },
3147
+ Explanation : func (errors Errors , pos int , tok * token.Token , args ... any ) string {
3148
+ return "The empty tuple '()' has no first element."
3149
+ },
3150
+ },
3151
+
3152
+ "vm/tup/last" : {
3153
+ Message : func (tok * token.Token , args ... any ) string {
3154
+ return "trying to take the last element of an empty tuple"
3155
+ },
3156
+ Explanation : func (errors Errors , pos int , tok * token.Token , args ... any ) string {
3157
+ return "The empty tuple '()' has no last element."
3158
+ },
3159
+ },
3160
+
3161
+ "vm/typecheck" : {
3162
+ Message : func (tok * token.Token , args ... any ) string {
3163
+ return "failed typecheck"
3164
+ },
3165
+ Explanation : func (errors Errors , pos int , tok * token.Token , args ... any ) string {
3166
+ return "You placed constraints on the types of this expression which you then violated."
3167
+ },
3168
+ },
3169
+
3020
3170
"vm/types/a" : {
3021
3171
Message : func (tok * token.Token , args ... any ) string {
3022
3172
return "No implementation of function " + emph (tok .Literal ) + " exists for the given types"
@@ -3053,6 +3203,16 @@ var ErrorCreatorMap = map[string]ErrorCreator{
3053
3203
},
3054
3204
},
3055
3205
3206
+ "vm/unwrap" : {
3207
+ Message : func (tok * token.Token , args ... any ) string {
3208
+ return "trying to unwrap something that isn't an 'error'"
3209
+ },
3210
+ Explanation : func (errors Errors , pos int , tok * token.Token , args ... any ) string {
3211
+ return "The 'unwrap' function converts things of type 'error' into type 'Error': " +
3212
+ "it doesn't work on anything else."
3213
+ },
3214
+ },
3215
+
3056
3216
"vm/with/a" : {
3057
3217
Message : func (tok * token.Token , args ... any ) string {
3058
3218
return fmt .Sprintf ("type %v found indexing list in %v expression where %v was expected" , emph (args [0 ]), emph ("with" ), emph ("int" ))
0 commit comments