From fb63df48aef2ae61a45a40fa79edea0116fd65b2 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sun, 5 Jul 2020 03:23:56 +0900 Subject: [PATCH] shader: Better error message --- internal/shader/stmt.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/shader/stmt.go b/internal/shader/stmt.go index 7e79c1b13..a535eea1c 100644 --- a/internal/shader/stmt.go +++ b/internal/shader/stmt.go @@ -18,6 +18,7 @@ import ( "fmt" "go/ast" "go/token" + "strings" "github.com/hajimehoshi/ebiten/internal/shaderir" ) @@ -117,7 +118,11 @@ func (cs *compileState) parseStmt(block *block, stmt ast.Stmt, inParams []variab return nil, false } if len(ts) != 1 || ts[0].Main != shaderir.Bool { - cs.addError(stmt.Pos(), fmt.Sprintf("if-condition must be bool but: %#v", ts)) + var tss []string + for _, t := range ts { + tss = append(tss, t.String()) + } + cs.addError(stmt.Pos(), fmt.Sprintf("if-condition must be bool but: %s", strings.Join(tss, ", "))) return nil, false } stmts = append(stmts, ss...)