diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..d2e6518c --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,23 @@ +name: build + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + go-versions: [ '1.18', '1.22' ] + go-arch: [ '386' ] + steps: + - uses: actions/checkout@v3 + - name: Setup Go ${{ matrix.go-version }} + uses: actions/setup-go@v4 + with: + go-version: ${{ matrix.go-version }} + - name: Build + run: GOARCH=${{ matrix.go-arch }} go build diff --git a/compiler/compiler.go b/compiler/compiler.go index c04611bd..457088d3 100644 --- a/compiler/compiler.go +++ b/compiler/compiler.go @@ -345,9 +345,7 @@ func (c *compiler) IntegerNode(node *ast.IntegerNode) { } c.emitPush(int32(node.Value)) case reflect.Int64: - if node.Value > math.MaxInt64 || node.Value < math.MinInt64 { - panic(fmt.Sprintf("constant %d overflows int64", node.Value)) - } + panic(fmt.Sprintf("constant %d overflows int64", node.Value)) c.emitPush(int64(node.Value)) case reflect.Uint: if node.Value < 0 { @@ -365,7 +363,7 @@ func (c *compiler) IntegerNode(node *ast.IntegerNode) { } c.emitPush(uint16(node.Value)) case reflect.Uint32: - if node.Value > math.MaxUint32 || node.Value < 0 { + if node.Value < 0 { panic(fmt.Sprintf("constant %d overflows uint32", node.Value)) } c.emitPush(uint32(node.Value))