Skip to content

Comments

fix: correctly resolve fields of aliased structs#1679

Merged
mvertes merged 3 commits intotraefik:masterfrom
secDre4mer:fix/linked-field-usage
Jan 8, 2025
Merged

fix: correctly resolve fields of aliased structs#1679
mvertes merged 3 commits intotraefik:masterfrom
secDre4mer:fix/linked-field-usage

Conversation

@secDre4mer
Copy link
Contributor

@secDre4mer secDre4mer commented Jan 7, 2025

Fields of types that are aliases are not always resolved correctly, especially if the aliased type is itself an alias.

A minimal example is:

package main

type original struct {
	Field string
}

func main() {
	type alias original
	type alias2 alias
	var a = &alias2{
		Field: "test",
	}
	println(a.Field)
}

There is already a method (baseType) for resolving the underlying struct type; but it isn't always used previous to this change.

Copy link
Collaborator

@mvertes mvertes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@mvertes mvertes merged commit f616581 into traefik:master Jan 8, 2025
12 checks passed
@mvertes mvertes added bug Something isn't working area/core labels Jan 8, 2025
@mvertes mvertes added this to the v0.16.x milestone Jan 8, 2025
@secDre4mer secDre4mer deleted the fix/linked-field-usage branch January 8, 2025 13:53
Bai-Yingjie pushed a commit to godevsig/yaegi that referenced this pull request Jun 9, 2025
Co-authored-by: Marc Vertes <mvertes@free.fr>
rcoreilly pushed a commit to cogentcore/yaegi that referenced this pull request Jun 21, 2025
Co-authored-by: Marc Vertes <mvertes@free.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants