-
Notifications
You must be signed in to change notification settings - Fork 397
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: interface to concrete type by T(ifaceVal) is not allowed #3757
base: master
Are you sure you want to change the base?
Conversation
🛠 PR Checks SummaryAll Automated Checks passed. ✅ Manual Checks (for Reviewers):
Read More🤖 This bot helps streamline PR reviews by verifying automated checks and providing guidance for contributors and reviewers. ✅ Automated Checks (for Contributors):No automated checks match this pull request. ☑️ Contributor Actions:
☑️ Reviewer Actions:
📚 Resources:Debug
|
9e6f5e1
to
e195990
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅ 📢 Thoughts on this report? Let us know! |
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.
I tested additional things and confirmed that they work well. LGTM
@@ -1423,7 +1424,16 @@ func preprocess1(store Store, ctx BlockNode, n Node) Node { | |||
checkOrConvertType(store, last, n, &n.Args[0], ct, false) | |||
} | |||
default: | |||
// do nothing | |||
ctBase := BaseOf(ct) |
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.
nitpick:
ctBase := BaseOf(ct) | |
ctBase := baseOf(ct) |
atBase := baseOf(at) | ||
|
||
_, isCTInterface := ctBase.(*InterfaceType) | ||
_, isCTNative := ctBase.(*NativeType) | ||
_, isATInterface := atBase.(*InterfaceType) | ||
|
||
if (!isCTInterface && !isCTNative) && isATInterface { | ||
panic(fmt.Sprintf("cannot convert %v to %v: need type assertion", at.TypeID(), ct.TypeID())) | ||
} |
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.
and it would be better the whole new added logic happens before the switch
.
These are missing checks for type casting between interfaces. See this: we can fix it in another PR tho. |
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.
looks good to me
Closes 3412