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

Avoid conversion from StaticType to sema.Type during runtime sub-type checking #3691

Open
Tracked by #3692
SupunS opened this issue Nov 21, 2024 · 0 comments
Open
Tracked by #3692

Comments

@SupunS
Copy link
Member

SupunS commented Nov 21, 2024

Issue to be solved

In Interpreter.IsSubType(...) function, both the sub-type and the super-type gets converted from StaticType to sema.Type (see below). This adds an unnecessary overhead.

semaSubType := interpreter.MustConvertStaticToSemaType(staticSubType)

semaType := interpreter.MustConvertStaticToSemaType(superType)

Suggested Solution

Having a separate sub-type checking implementation for runtime (static types) could eliminate this overhead. We could define the sub-typing rules in some declarative format, and then generate the two implementations from that, to make them consistent/in-sync.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant