浏览代码

disallow closures on generic functions (closes #2518)

Simon Krajewski 11 年之前
父节点
当前提交
fe0d929165
共有 1 个文件被更改,包括 1 次插入0 次删除
  1. 1 0
      typer.ml

+ 1 - 0
typer.ml

@@ -871,6 +871,7 @@ let field_access ctx mode f fmode t e p =
 			| MethMacro, MCall -> AKMacro (e,f)
 			| _ , MGet ->
 				let cmode = (match fmode with
+					| FInstance(_, cf) | FStatic(_, cf) when Meta.has Meta.Generic cf.cf_meta -> display_error ctx "Cannot create closure on generic function" p; fmode
 					| FInstance (c,cf) -> FClosure (Some c,cf)
 					| FStatic _ | FEnum _ -> fmode
 					| FAnon f -> FClosure (None, f)