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

Constraint check error position is not accurate #9393

Closed
nadako opened this issue May 7, 2020 · 3 comments · Fixed by #9549
Closed

Constraint check error position is not accurate #9393

nadako opened this issue May 7, 2020 · 3 comments · Fixed by #9549

Comments

@nadako
Copy link
Member

nadako commented May 7, 2020

In the example above, the "constraint check failure" error will be reported at the position of f (not even the call). I think I understand why that's happening (it's checking the field itself, not really a call argument, right?), but maybe it is possible to store a position of a thing that made T an actual type (1 in this example).

class Main {
	static function f<T:String>(v:T) {}
	static function main() {
		f(1);
	}
}
@nadako nadako added this to the Backlog milestone May 7, 2020
@Simn
Copy link
Member

Simn commented May 7, 2020

IMO this is not worth fixing. Addressing this in the general case (where there's no 1:1 mapping between argument and type parameter) would require quite a bit of effort which I don't think is justified.

It can probably be changed to give the error of the call as a whole instead of the field, but trying to map this to individual arguments seems pretty crazy.

@nadako
Copy link
Member Author

nadako commented Jun 10, 2020

Is this test-needed or it's covered by position changes in existing tests?

@Simn
Copy link
Member

Simn commented Jun 10, 2020

I figured that this was covered by the other tests where the position became more narrow.

Simn added a commit that referenced this issue Jun 16, 2020
Simn added a commit that referenced this issue Jun 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants