Nim/tests/distinct
Ivan Bobev 3c85aa9e53
Make {.requiresInit.} to work for distinct types (#15869)
Make `requiresInit` pragma to work for distinct types in addition to
objects. Tagging of distinct types with `requiresInit` pragma was
already supported, but its impact wasn't applied. Now its behavior when
applied on distinct types is as follows.

Given the following distinct type definitions:

  ```nim
  type
    DistinctObject {.requiresInit, borrow: `.`.} = distinct MyObject
    DistinctString {.requiresInit.} = distinct string
  ```

The following code blocks will fail to compile:

  ```nim
  var foo: DistinctFoo
  foo.x = "test"
  doAssert foo.x == "test"
  ```

  ```nim
  var s: DistinctString
  s = "test"
  doAssert s == "test"
  ```

But these ones will compile successfully:

  ```nim
  let foo = DistinctFoo(Foo(x: "test"))
  doAssert foo.x == "test"
  ```

  ```nim
  let s = "test"
  doAssert s == "test"
  ```
2020-11-06 18:56:09 +00:00
..
t7165.nim add testcase for #7165 (#15368) 2020-09-21 13:32:05 +02:00
tdistinct.nim Make {.requiresInit.} to work for distinct types (#15869) 2020-11-06 18:56:09 +00:00
tdistinct_issues.nim More descriptive names of test files (#9531) 2018-10-29 17:07:27 +01:00
tnil.nim require errormsg to be specified before file. 2018-12-11 21:23:21 +01:00