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

Unexpected behavior of the gop compiler #465

Closed
JiepengTan opened this issue Dec 5, 2024 · 1 comment · Fixed by goplus/gogen#453 or goplus/gop#2030
Closed

Unexpected behavior of the gop compiler #465

JiepengTan opened this issue Dec 5, 2024 · 1 comment · Fixed by goplus/gogen#453 or goplus/gop#2030
Labels
bug Something isn't working

Comments

@JiepengTan
Copy link
Collaborator

JiepengTan commented Dec 5, 2024

No matter if turnTo 180 or turnTo 180.0 is used, it always compiles to TurnTo__2. It is expected to compile to TurnTo__3 or TurnTo__5.

test project: ./test/_Quote

spx engine code:

type specialObj int
func (p *SpriteImpl) TurnTo__1(sprite SpriteName) {
	p.turnTo(sprite)
}

func (p *SpriteImpl) TurnTo__2(obj specialObj) {
	p.turnTo(obj)
}

func (p *SpriteImpl) TurnTo__3(degree float64) {
	p.turnTo(degree)
}
func (p *SpriteImpl) TurnTo__4(dir specialDir) {
	p.turnTo(dir)
}
func (p *SpriteImpl) TurnTo__5(dir int) {
	p.turnTo(dir)
}

.spx file

onStart => {
	turnTo 180
}
onStart => {
	turnTo 180.0
}

auto_generated.go

func (this *Crocodile) Main() {
//line test/_Quote/Crocodile.spx:1:1
	this.OnStart(func() {
//line test/_Quote/Crocodile.spx:4:1
		this.TurnTo__2(180.0)
	})

gop version:

  • gop v1.3.0-pre.2 devel windows/amd64 ,
  • build from source : SHA-1: 06a9e206c998a7371a763b327d4367dae68ee2ee
    • Merge pull request #2017 from xushiwei/q
@JiepengTan JiepengTan added the bug Something isn't working label Dec 5, 2024
@JiepengTan JiepengTan changed the title Gop compiler unexpected behaviour Unexpected behavior of the gop compiler Dec 5, 2024
@JiepengTan
Copy link
Collaborator Author

@visualfc @aofei

aofei added a commit to aofei/.goplus.spx that referenced this issue Dec 5, 2024
This is a workaround for goplus#465.

Signed-off-by: Aofei Sheng <aofei@aofeisheng.com>
aofei added a commit to aofei/.goplus.spx that referenced this issue Dec 5, 2024
This is a workaround for goplus#465.

Signed-off-by: Aofei Sheng <aofei@aofeisheng.com>
nighca pushed a commit that referenced this issue Dec 5, 2024
This is a workaround for #465.

Signed-off-by: Aofei Sheng <aofei@aofeisheng.com>
JiepengTan added a commit to JiepengTan/spx that referenced this issue Dec 6, 2024
This is a workaround for goplus#465.

Signed-off-by: Aofei Sheng <aofei@aofeisheng.com>
JiepengTan added a commit to JiepengTan/spx that referenced this issue Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant