-
Notifications
You must be signed in to change notification settings - Fork 4
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 basic type conversions from pointer to non-pointer #43
Conversation
@@ -12,6 +12,8 @@ type ClusterNode struct { | |||
Label Label | |||
// Labels []Label | |||
// WorkPointer []*Workload | |||
Flag *bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a pair of bool/uint32 pointer to non pointer conversions to the e2e test.
@@ -10,6 +10,13 @@ func NodeToCore(s *Node, t *core.ClusterNode) { | |||
} | |||
t.ID = s.ID | |||
t.Label = core.Label(s.Label) | |||
t.Flag = &s.Flag |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shows you what the updated basic type conversion code looks like when crossing pointer/nonpointer boundaries.
leftRealType = leftPtrType.X | ||
} | ||
|
||
return &ast.IfStmt{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This lifted code from the existing area of code that handled the struct-to-struct conversions, which are different than basic type conversions for Go reasons.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
Conversions from things like
bool <-> *bool
oruint32 <-> *uint32
would panic if the RHS wasnil
as it would just generate:This fixes it so that it does the following in that scenario: