Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run: 498:22: "undefined type for E" #1668

Open
LazataknesSoftware opened this issue Nov 23, 2024 · 0 comments
Open

run: 498:22: "undefined type for E" #1668

LazataknesSoftware opened this issue Nov 23, 2024 · 0 comments

Comments

@LazataknesSoftware
Copy link

The following program sample.go triggers an unexpected result

package main

import (
        "fmt"
        "math"
        "slices"
        "flag"
        "strings"
)

func main() {
        nums := map[string]int{"I": 1, "V": 5, "X": 10}
        var II []string
        var NN []int
        var final string = ""
        var num float64
        flag.Float64Var(&num, "n", 10.0, "Number")
        flag.Parse()
        for k, v := range nums {
                II = append(II, k)
                NN = append(NN, v)
        }
        slices.Reverse(II)
        slices.Reverse(NN)
        for _, cycle := range NN {
                t := int(math.Floor(num / float64(cycle)))
                final += strings.Repeat(II[slices.Index(NN, cycle)],
 t)
                num -= float64(cycle * (t))
        }
        fmt.Printf("%v\n", final)
}

Expected result

$ go run ./sample.go -n=11
XI

Got

$ yaegi ./sample.go -n=11
run: 498:22: undefined type for E

Yaegi Version

0.16.1

Additional Notes

OS/Environment: Android 9 Go/Termux
Device: ZTE Blade A3 2020
uname -a: "Linux localhost 4.4.147+ #1 SMP PREEMPT Tue Sep 29 02:20:41 CST 2020 armv7l Android"
go version: "go version go1.23.2 android/arm"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant