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

checker, cgen: allow op overload for type with generic parent #21262

Merged

Conversation

Delta456
Copy link
Member

This PR compiles the following code:

import math.vec


type Vec3 = vec.Vec3[f64]

fn main() {
	a := Vec3{1.0, 2.0, 3.0}
	b := Vec3{0.5, 1.5, 2.5}
	println(a - b)
}

Previously it wasn't working.

Copy link
Member

@spytheman spytheman left a comment

Choose a reason for hiding this comment

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

Excellent work.

@spytheman spytheman merged commit 433f914 into vlang:master Apr 12, 2024
56 checks passed
@Delta456 Delta456 deleted the operator_overloading_alias_generic_parent_type branch April 12, 2024 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants