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

fix importName for multi-import in single file #466

Merged
merged 1 commit into from
Jan 21, 2025

Conversation

nighca
Copy link
Contributor

@nighca nighca commented Jan 20, 2025

In goplus/igop#275, we use spx@patch to enable generic types in igop. The expected output for an spx project is:

package main

import (
	"github.com/goplus/spx"
	spx1 "github.com/goplus/spx@patch"
)

func (this *Game) MainEntry() {
	// ...
	spx1.Gopt_Game_Gopx_GetWidget[spx.Monitor](this, "monitor")
	// ...
}

However, after #445, the spx project is compiled to:

import (
	"github.com/goplus/spx"
	"github.com/goplus/spx@patch"
)

func (this *Game) MainEntry() {
	// ...
	spx.Gopt_Game_Gopx_GetWidget[spx.Monitor](this, "monitor")
	// ...
}

That leads to an error when running the compiled code:

Failed to run Go+ source: main.go:5:2: spx redeclared in this block  Code: 2

This PR addresses the issue by implementing import-name coordination within file.

Copy link

codecov bot commented Jan 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.93%. Comparing base (dc8cddf) to head (e195189).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #466   +/-   ##
=======================================
  Coverage   95.93%   95.93%           
=======================================
  Files          18       18           
  Lines        7184     7191    +7     
=======================================
+ Hits         6892     6899    +7     
  Misses        228      228           
  Partials       64       64           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@nighca
Copy link
Contributor Author

nighca commented Jan 20, 2025

@visualfc @xushiwei Plz review.

@xushiwei xushiwei merged commit 682e395 into goplus:main Jan 21, 2025
14 checks passed
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

Successfully merging this pull request may close these issues.

3 participants