mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 03:38:55 +01:00
ebiten: Bug fix: Test failuer (TestShaderWrongReturn)
This commit is contained in:
parent
d001f49ad7
commit
a0db26f234
@ -404,8 +404,12 @@ func (cs *compileState) parseStmt(block *block, fname string, stmt ast.Stmt, inP
|
|||||||
cs.addError(r.Pos(), "single-value context and multiple-value context cannot be mixed")
|
cs.addError(r.Pos(), "single-value context and multiple-value context cannot be mixed")
|
||||||
return nil, false
|
return nil, false
|
||||||
}
|
}
|
||||||
if len(exprs) != len(outParams) {
|
}
|
||||||
|
// TODO: Is this logic really true?
|
||||||
|
if len(exprs) > 1 || len(outParams) > 1 {
|
||||||
|
if len(exprs) != len(outParams) && len(stmt.Results) != len(outParams) {
|
||||||
cs.addError(stmt.Pos(), fmt.Sprintf("the number of returning variables must be %d but %d", len(outParams), len(stmt.Results)))
|
cs.addError(stmt.Pos(), fmt.Sprintf("the number of returning variables must be %d but %d", len(outParams), len(stmt.Results)))
|
||||||
|
return nil, false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,7 +244,7 @@ func TestShaderWrongReturn(t *testing.T) {
|
|||||||
if _, err := NewShader([]byte(`package main
|
if _, err := NewShader([]byte(`package main
|
||||||
|
|
||||||
func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
|
func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
|
||||||
return 0.0;
|
return 0.0
|
||||||
}
|
}
|
||||||
`)); err == nil {
|
`)); err == nil {
|
||||||
t.Errorf("error must be non-nil but was nil")
|
t.Errorf("error must be non-nil but was nil")
|
||||||
@ -253,11 +253,11 @@ func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
|
|||||||
if _, err := NewShader([]byte(`package main
|
if _, err := NewShader([]byte(`package main
|
||||||
|
|
||||||
func Foo() (float, float) {
|
func Foo() (float, float) {
|
||||||
return 0;
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
|
func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
|
||||||
return vec4(0);
|
return vec4(0)
|
||||||
}
|
}
|
||||||
`)); err == nil {
|
`)); err == nil {
|
||||||
t.Errorf("error must be non-nil but was nil")
|
t.Errorf("error must be non-nil but was nil")
|
||||||
|
Loading…
Reference in New Issue
Block a user