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

Fix @:require vs overload #10891

Merged
merged 6 commits into from
Dec 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/typing/typeloadFields.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1772,7 +1772,11 @@ let init_class ctx c p context_init herits fields =
if not cctx.is_native && not (has_class_flag c CExtern) && dup then typing_error ("Same field name can't be used for both static and instance : " ^ cf.cf_name) p;
if fctx.override <> None then
add_class_field_flag cf CfOverride;
let is_var cf = match cf.cf_kind with | Var _ -> true | _ -> false in
let is_var cf = match cf.cf_kind with
| Var {v_read = AccRequire _; v_write = AccRequire _} -> false
| Var _ -> true
| _ -> false
in
if PMap.mem cf.cf_name (if fctx.is_static then c.cl_statics else c.cl_fields) then
if has_class_field_flag cf CfOverload && not (is_var cf) then
let mainf = PMap.find cf.cf_name (if fctx.is_static then c.cl_statics else c.cl_fields) in
Expand Down
5 changes: 5 additions & 0 deletions tests/misc/projects/Issue10890/Main.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
extern class Main {
overload function test(b:Bool):Void;
@:require(false) overload function test(i:Int):Void;
@:require(false) overload function test(s:String):Void;
}
1 change: 1 addition & 0 deletions tests/misc/projects/Issue10890/build.hxml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Main