Skip to content

Move private accessor check to field_access #12273

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

Merged
merged 7 commits into from
Jun 11, 2025

Conversation

RblSb
Copy link
Member

@RblSb RblSb commented Jun 10, 2025

It merges errors like

Main.hx:70: characters 7-12 : Cannot access private field width
Main.hx:70: characters 3-12 : This property cannot be accessed for writing

Into second one. Also improves error range from obj.field to field.
Hope i check bypass_accessor correctly.

@Simn
Copy link
Member

Simn commented Jun 10, 2025

Let's also test all three combinations with both ++ and +=, so (public, private), (private, public) and (private, private).

Edit: I mean test that they fail properly from the outside.

@RblSb
Copy link
Member Author

RblSb commented Jun 11, 2025

Is foo++ and foo += 1 should fail with private get while foo = 1 is not, as i understand?

And there is one place where i did not update position, not sure if there is example where i can see bad error pos:

| AKField fa ->
let vr = new value_reference ctx in
let ef = vr#get_expr_part "fh" fa.fa_on in
let access_get = type_field_default_cfg ctx ef fa.fa_field.cf_name p MGet WithType.value in

pass only `obj.foo` instead of `obj.foo += 1` to `type_field`
@Simn
Copy link
Member

Simn commented Jun 11, 2025

Is foo++ and foo += 1 should fail with private get while foo = 1 is not, as i understand?

Yes that's what I would expect.

@RblSb
Copy link
Member Author

RblSb commented Jun 11, 2025

Should be ready. Windows CI hanged on my test once, maybe too many errors in one file, so if it will happen again another split up can be made.

@Simn
Copy link
Member

Simn commented Jun 11, 2025

Ah that might be a concern with the Process API indeed. But I'll just ping you if it happens!

@Simn Simn merged commit 05e59be into HaxeFoundation:development Jun 11, 2025
47 checks passed
@RblSb RblSb deleted the private-move branch June 11, 2025 08:00
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