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

type definition ordering strangeness #13

Open
andydotxyz opened this issue Jun 23, 2023 · 3 comments
Open

type definition ordering strangeness #13

andydotxyz opened this issue Jun 23, 2023 · 3 comments

Comments

@andydotxyz
Copy link

Applying the latest version in Fyne's geometry.go I see the following order of public types:

type Delta struct
type Position struct
type Size struct
func NewDelta(dx float32, dy float32) Delta
func NewPos(x float32, y float32) Position
func NewSize(w float32, h float32) Size
type Vector2 interface

After this the type methods are added. I'm not totally sure, but this seems not quite right...

@andydotxyz
Copy link
Author

Another strange thing in canvas/image.go the type definition order is right but the const order seems backwards:

type ImageFill int
type ImageScale int32

const (
    ImageScaleSmooth ImageScale = iota
...
)

const (
    ImageFillStretch ImageFill = iota
...
)

@andydotxyz
Copy link
Author

Lastly in layout/boxlayout we can see constructor functions returning a more generic type appear last:

func (g *boxLayout) isSpacer(obj fyne.CanvasObject) bool {
...
}

func NewHBoxLayout() fyne.Layout
func NewVBoxLayout() fyne.Layout

@metal3d
Copy link
Owner

metal3d commented Jun 24, 2023

I will take a look as soon as I can - Fyne is a great source base to make this kind of tests.

metal3d added a commit that referenced this issue Jun 26, 2023
With no pointer receiver or return type, the constructors and methods
were not detected.

See #13 - on the comment
#13 (comment) - the
problem seems to be resolved for this case.

TODO: vars are not joined, a new line appends after each...
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

No branches or pull requests

2 participants