mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-29 09:24:36 +00:00
fixes #10038; deprecate generic methods, they are unreliable
This commit is contained in:
@@ -33,6 +33,7 @@
|
||||
tree from the symbol declaration instead of just the initializer portion.
|
||||
|
||||
- To use multi-methods, explicit `--multimethods:on` is now needed.
|
||||
- Generic methods are now deprecated; they never worked well.
|
||||
|
||||
- Compile time checks for integer and float conversions are now stricter.
|
||||
For example, `const x = uint32(-1)` now gives a compile time error instead
|
||||
@@ -45,7 +46,8 @@
|
||||
- A bug allowed `macro foo(): int = 123` to compile even though a
|
||||
macros has to return a `NimNode`. This has been fixed.
|
||||
|
||||
- With the exception of `uint` and `uint64`, conversion to unsigned types are now range checked during runtime.
|
||||
- With the exception of `uint` and `uint64`, conversion to unsigned types
|
||||
are now range checked during runtime.
|
||||
|
||||
#### Breaking changes in the standard library
|
||||
|
||||
|
||||
@@ -1712,8 +1712,9 @@ proc semMethodPrototype(c: PContext; s: PSym; n: PNode) =
|
||||
if x.kind == tyObject and t.len-1 == n.sons[genericParamsPos].len:
|
||||
foundObj = true
|
||||
x.methods.add((col,s))
|
||||
if not foundObj:
|
||||
message(c.config, n.info, warnDeprecated, "generic method not attachable to object type is deprecated")
|
||||
message(c.config, n.info, warnDeprecated, "generic methods are deprecated")
|
||||
#if not foundObj:
|
||||
# message(c.config, n.info, warnDeprecated, "generic method not attachable to object type is deprecated")
|
||||
else:
|
||||
# why check for the body? bug #2400 has none. Checking for sfForward makes
|
||||
# no sense either.
|
||||
|
||||
@@ -3526,6 +3526,8 @@ the effects that a call to ``m`` might cause.
|
||||
|
||||
**Note**: Compile-time execution is not (yet) supported for methods.
|
||||
|
||||
**Note**: Starting from Nim 0.20, generic methods are deprecated.
|
||||
|
||||
|
||||
Inhibit dynamic method resolution via procCall
|
||||
-----------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user