summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--doc/manual/type_bound_ops.txt13
-rw-r--r--tests/destructor/tdestructor.nim16
-rw-r--r--tests/destructor/tdestructor2.nim8
3 files changed, 18 insertions, 19 deletions
diff --git a/doc/manual/type_bound_ops.txt b/doc/manual/type_bound_ops.txt
index 2f7cbc79c..efa5578d4 100644
--- a/doc/manual/type_bound_ops.txt
+++ b/doc/manual/type_bound_ops.txt
@@ -56,10 +56,9 @@ destructors
 -----------
 
 A destructor must have a single parameter with a concrete type (the name of a
-generic type is allowed too). The name of the destructor has to be ``destroy``
-and it need to be annotated with the ``override`` pragma.
+generic type is allowed too). The name of the destructor has to be ``=destroy``.
 
-``destroy(v)`` will be automatically invoked for every local stack
+``=destroy(v)`` will be automatically invoked for every local stack
 variable ``v`` that goes out of scope.
 
 If a structured type features a field with destructable type and
@@ -76,7 +75,7 @@ can then only be used in *destructible contexts* and as parameters:
       x, y: int
       p: pointer
 
-  proc destroy(o: var MyObj) {.override.} =
+  proc `=destroy`(o: var MyObj) =
     if o.p != nil: dealloc o.p
 
   proc open: MyObj =
@@ -108,7 +107,7 @@ be destructed at its scope exit. Later versions of the language will improve
 the support of destructors.
 
 Be aware that destructors are not called for objects allocated with ``new``.
-This may change in future versions of language, but for now the ``finalizer``
+This may change in future versions of language, but for now the `finalizer`:idx:
 parameter to ``new`` has to be used.
 
 **Note**: Destructors are still experimental and the spec might change
@@ -118,7 +117,7 @@ significantly in order to incorporate an escape analysis.
 deepCopy
 --------
 
-``deepCopy`` is a builtin that is invoked whenever data is passed to
+``=deepCopy`` is a builtin that is invoked whenever data is passed to
 a ``spawn``'ed proc to ensure memory safety. The programmer can override its
 behaviour for a specific ``ref`` or ``ptr`` type ``T``. (Later versions of the
 language may weaken this restriction.)
@@ -126,7 +125,7 @@ language may weaken this restriction.)
 The signature has to be:
 
 .. code-block:: nim
-  proc deepCopy(x: T): T {.override.}
+  proc `=deepCopy`(x: T): T
 
 This mechanism is used by most data structures that support shared memory like
 channels to implement thread safe automatic memory management.
diff --git a/tests/destructor/tdestructor.nim b/tests/destructor/tdestructor.nim
index cbaba3154..639dba941 100644
--- a/tests/destructor/tdestructor.nim
+++ b/tests/destructor/tdestructor.nim
@@ -40,7 +40,7 @@ type
     x: A
     y: B
     z: C
-  
+
   TObjKind = enum A, B, C, D
 
   TCaseObj = object
@@ -57,14 +57,14 @@ type
         q: TMyGeneric3[TMyObj, int, int]
       r: string
 
-proc destroy(o: var TMyObj) {.override.} =
+proc `=destroy`(o: var TMyObj) =
   if o.p != nil: dealloc o.p
   echo "myobj destroyed"
 
-proc destroy(o: var TMyGeneric1) {.override.} =
+proc `=destroy`(o: var TMyGeneric1) =
   echo "mygeneric1 destroyed"
 
-proc destroy[A, B](o: var TMyGeneric2[A, B]) {.override.} =
+proc `=destroy`[A, B](o: var TMyGeneric2[A, B]) =
   echo "mygeneric2 destroyed"
 
 proc open: TMyObj =
@@ -83,12 +83,12 @@ proc mygeneric1() =
 
 proc mygeneric2[T](val: T) =
   var a = open()
-  
+
   var b = TMyGeneric2[int, T](x: 10, y: val)
   echo "mygeneric2 constructed"
 
   var c = TMyGeneric3[int, int, string](x: 10, y: 20, z: "test")
-  
+
 proc mygeneric3 =
   var x = TMyGeneric3[int, string, TMyGeneric1[int]](
     x: 10, y: "test", z: TMyGeneric1[int](x: 10))
@@ -111,11 +111,11 @@ proc caseobj =
   block:
     echo "----"
     var o1 = TCaseObj(kind: A, x: TMyGeneric1[int](x: 10))
-  
+
   block:
     echo "----"
     var o2 = TCaseObj(kind: B, y: open())
-  
+
   block:
     echo "----"
     var o3 = TCaseObj(kind: D, innerKind: B, r: "test",
diff --git a/tests/destructor/tdestructor2.nim b/tests/destructor/tdestructor2.nim
index 6f966d861..34fa466af 100644
--- a/tests/destructor/tdestructor2.nim
+++ b/tests/destructor/tdestructor2.nim
@@ -5,14 +5,14 @@ discard """
 
 {.experimental.}
 
-type  
+type
   TMyObj = object
     x, y: int
     p: pointer
-    
-proc destroy(o: var TMyObj) {.override.} =
+
+proc `=destroy`(o: var TMyObj) =
   if o.p != nil: dealloc o.p
-  
+
 proc open: TMyObj =
   result = TMyObj(x: 1, y: 2, p: alloc(3))