File tree Expand file tree Collapse file tree 3 files changed +62
-1
lines changed Expand file tree Collapse file tree 3 files changed +62
-1
lines changed Original file line number Diff line number Diff line change @@ -345,7 +345,6 @@ func (c *compiler) IntegerNode(node *ast.IntegerNode) {
345345 }
346346 c .emitPush (int32 (node .Value ))
347347 case reflect .Int64 :
348- panic (fmt .Sprintf ("constant %d overflows int64" , node .Value ))
349348 c .emitPush (int64 (node .Value ))
350349 case reflect .Uint :
351350 if node .Value < 0 {
Original file line number Diff line number Diff line change @@ -628,3 +628,25 @@ func TestCompile_optimizes_jumps(t *testing.T) {
628628 })
629629 }
630630}
631+
632+ func TestCompile_IntegerArgsFunc (t * testing.T ) {
633+ env := mock.Env {}
634+ tests := []struct { code string }{
635+ {"FuncInt(0)" },
636+ {"FuncInt8(0)" },
637+ {"FuncInt16(0)" },
638+ {"FuncInt32(0)" },
639+ {"FuncInt64(0)" },
640+ {"FuncUint(0)" },
641+ {"FuncUint8(0)" },
642+ {"FuncUint16(0)" },
643+ {"FuncUint32(0)" },
644+ {"FuncUint64(0)" },
645+ }
646+ for _ , tt := range tests {
647+ t .Run (tt .code , func (t * testing.T ) {
648+ _ , err := expr .Compile (tt .code , expr .Env (env ))
649+ require .NoError (t , err )
650+ })
651+ }
652+ }
Original file line number Diff line number Diff line change @@ -65,6 +65,46 @@ func (p Env) FuncTyped(_ string) int {
6565 return 2023
6666}
6767
68+ func (p Env ) FuncInt (_ int ) int {
69+ return 0
70+ }
71+
72+ func (p Env ) FuncUint (_ uint ) int {
73+ return 0
74+ }
75+
76+ func (p Env ) FuncInt8 (_ float64 ) int {
77+ return 0
78+ }
79+
80+ func (p Env ) FuncInt16 (_ int16 ) int {
81+ return 0
82+ }
83+
84+ func (p Env ) FuncInt32 (_ int32 ) int {
85+ return 0
86+ }
87+
88+ func (p Env ) FuncInt64 (_ int64 ) int {
89+ return 0
90+ }
91+
92+ func (p Env ) FuncUint8 (_ uint8 ) int {
93+ return 0
94+ }
95+
96+ func (p Env ) FuncUint16 (_ uint16 ) int {
97+ return 0
98+ }
99+
100+ func (p Env ) FuncUint32 (_ uint32 ) int {
101+ return 0
102+ }
103+
104+ func (p Env ) FuncUint64 (_ uint64 ) int {
105+ return 0
106+ }
107+
68108func (p Env ) TimeEqualString (a time.Time , s string ) bool {
69109 return a .Format ("2006-01-02" ) == s
70110}
You can’t perform that action at this time.
0 commit comments