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

internal/shader: unexpected syntax error with a switch statement and an & operator #3141

Closed
11 tasks
hajimehoshi opened this issue Oct 21, 2024 · 1 comment
Closed
11 tasks

Comments

@hajimehoshi
Copy link
Owner

Ebitengine Version

74f812d

Operating System

  • Windows
  • macOS
  • Linux
  • FreeBSD
  • OpenBSD
  • Android
  • iOS
  • Nintendo Switch
  • PlayStation 5
  • Xbox
  • Web Browsers

Go Version (go version)

go version go1.23.1 darwin/arm64

What steps will reproduce the problem?

Run this test in the ebiten package:

func TestShaderCompile(t *testing.T) {
	if _, err := ebiten.NewShader([]byte(`//kage:unit pixels

package main

func Fragment(dstPos vec4, srcPos vec2, color vec4) vec4 {
	x := 0
	switch x & 1 {
	default:
	}
	return vec4(0)
}
`)); err != nil {
		t.Fatal(err)
	}
}

What is the expected result?

The test passes

What happens instead?

The test fails

shader_test.go:2835: 7:2: unexpected statement: &ast.SwitchStmt{Switch:103, Init:ast.Stmt(nil), Tag:(*ast.BinaryExpr)(0x140003abdd0), Body:(*ast.BlockStmt)(0x140003abe00)}

Anything else you feel useful to add?

No response

@hajimehoshi hajimehoshi added this to the v2.8.2 milestone Oct 21, 2024
@hajimehoshi
Copy link
Owner Author

Simply, switch statement is not supported yet.

@hajimehoshi hajimehoshi closed this as not planned Won't fix, can't repro, duplicate, stale Oct 21, 2024
@hajimehoshi hajimehoshi removed this from the v2.8.2 milestone Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant