compiler: do not convert interop types on assertion

This commit is contained in:
Evgeniy Stratonikov 2021-02-05 13:06:42 +03:00
parent 2f6345f2d9
commit 73a75cc27a
2 changed files with 14 additions and 2 deletions

View file

@ -284,3 +284,12 @@ func isInteropPath(s string) bool {
func isNativeHelpersPath(s string) bool {
return strings.HasPrefix(s, interopPrefix+"/native")
}
// canConvert returns true if type doesn't need to be converted on type assertion.
func canConvert(s string) bool {
if isInteropPath(s) {
s = s[len(interopPrefix):]
return s != "/iterator.Iterator" && s != "/storage.Context"
}
return true
}