summary refs log tree commit diff stats
path: root/config
diff options
context:
space:
mode:
authormetagn <metagngn@gmail.com>2023-09-18 07:39:22 +0300
committerGitHub <noreply@github.com>2023-09-18 06:39:22 +0200
commit5f9038a5d76847ebb922dc34c3333879e8160426 (patch)
treebf71da1f61d73fe76ac93487dbe70aaf88ca749c /config
parentfcf4c1ae172080b8ef00b173977c223836bdebf2 (diff)
downloadNim-5f9038a5d76847ebb922dc34c3333879e8160426.tar.gz
make expressions opt in to symchoices (#22716)
refs #22605

Sym choice nodes are now only allowed to pass through semchecking if
contexts ask for them to (with `efAllowSymChoice`). Otherwise they are
resolved or treated as ambiguous. The contexts that can receive
symchoices in this PR are:

* Call operands and addresses and emulations of such, which will subject
them to overload resolution which will resolve them or fail.
* Type conversion operands only for routine symchoices for type
disambiguation syntax (like `(proc (x: int): int)(foo)`), which will
resolve them or fail.
* Proc parameter default values both at the declaration and during
generic instantiation, which undergo type narrowing and so will resolve
them or fail.

This means unless these contexts mess up sym choice nodes should never
leave the semchecking stage. This serves as a blueprint for future
improvements to intermediate symbol resolution.

Some tangential changes are also in this PR:

1. The `AmbiguousEnum` hint is removed, it was always disabled by
default and since #22606 it only started getting emitted after the
symchoice was soundly resolved.
2. Proc setter syntax (`a.b = c` becoming `` `b=`(a, c) ``) used to
fully type check the RHS before passing the transformed call node to
proc overloading. Now it just passes the original node directly so proc
overloading can deal with its typechecking.
Diffstat (limited to 'config')
-rw-r--r--config/nim.cfg4
1 files changed, 0 insertions, 4 deletions
diff --git a/config/nim.cfg b/config/nim.cfg
index 7a2d5c76e..7c9958139 100644
--- a/config/nim.cfg
+++ b/config/nim.cfg
@@ -18,10 +18,6 @@ cc = gcc
   hint[LineTooLong]=off
 @end
 
-@if nimHasAmbiguousEnumHint:
-  # not needed if hint is a style check
-  hint[AmbiguousEnum]=off
-@end
 #hint[XDeclaredButNotUsed]=off
 
 threads:on