Commit Graph

27 Commits

Author SHA1 Message Date
Khaled Hammouda
caf6aff06b Fix distinct requiresInit test and manual (#19901)
fix distinct test and manual
2022-06-22 12:36:30 +02:00
Jason Beetham
83a2515af7 Fixed generic distinct conversions for 'var' (#18837)
* SameTypeAux now properly traverses generic distincts

* Smarter traversal of distincts

* Removed redundant check

* Fixed nkConv for jsgen

* Added test for non distinct nkConv

* using skiptypes for distinct now

* Fixed genaddr for nkconv
2021-10-26 11:27:11 +02:00
Jason Beetham
ee2eb5cae2 Fix subranges of distinct types (#18816) [backport] 2021-09-07 17:11:08 +02:00
Timothee Cour
8ee0eda841 fix #12282 distinct now does not create erroneous copy in VM (#17594) 2021-03-31 10:15:08 +02:00
flywind
aa185c0e9b fix #13517 (#16681) 2021-01-11 15:07:48 +01:00
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
flywind
6c83eb48c2 add testcase for #7165 (#15368)
* add testcase for #7165

* Remove overspecific testament spec

Co-authored-by: Clyybber <darkmine956@gmail.com>
2020-09-21 13:32:05 +02:00
Andreas Rumpf
de1ede77fe fixes #11715 (#11721) 2019-07-13 07:55:56 +02:00
Andreas Rumpf
1e97b420bb fixes #7167 (#11300)
* fixes #7167
* spec: distinct types can be ordinal types
* bootstrapping issue
2019-05-22 11:50:05 +02:00
Arne Döring
a5ecbf823f lots of small changes 2018-12-11 21:23:22 +01:00
Arne Döring
1105d03644 require errormsg to be specified before file. 2018-12-11 21:23:21 +01:00
Miran
1b17c9f693 More descriptive names of test files (#9531)
* change generic `tissues` name to more specific
* change `tvarious` to more specific names
2018-10-29 17:07:27 +01:00
Araq
f8e805a614 fixes #2760 2018-10-15 10:43:56 +02:00
Miran
3c9fcc4c30 Merge tests into a larger file (part 2 of ∞) (#9335)
* merge controlflow tests

* merge distinct tests

* merge enum tests

* merge fields tests

* merge implicit tests

* merge iter issues tests
2018-10-13 14:58:31 +02:00
LemonBoy
fab4d38411 string to string conversion keeps the dest type (#9323)
Fixes #9322
2018-10-12 08:50:28 +02:00
jcosborn
dd65986795 fixes #4435 (#9185) 2018-10-09 13:34:03 +02:00
LemonBoy
e9b5a4e25d Constant folding should not drop distinct types
Fixes #9079
2018-09-27 17:08:01 +02:00
Ganesh Viswanathan
4e305c3040 Test case for #7010 2018-09-14 14:07:31 -05:00
Araq
f91a181f58 make tests green again 2018-08-13 23:16:03 +02:00
Araq
21cbf438ce make tests green 2018-05-02 13:34:54 +02:00
Araq
16260b23c7 make tests on Windows green 2017-01-31 23:05:36 +01:00
Andreas Rumpf
1690b912ca test case cleanup 2016-08-26 15:16:11 +02:00
Hans Raaf
e2e4df1702 Allowing nil for distinct types where the base type is nilable 2016-08-05 16:01:16 +02:00
Adam Strzelecki
e80465dacf tests: Trim .nim files trailing whitespace
via OSX: find . -name '*.nim' -exec sed -i '' -E 's/[[:space:]]+$//' {} +
2015-09-04 23:04:32 +02:00
Araq
e23857a98b fixes #2629, fixes #2641, fixes #2632, fixes #2630 2015-05-03 01:08:52 +02:00
Araq
7874c0efcb borrow dots for distinct types documented 2014-03-26 08:42:27 +01:00
Araq
20b5f31c03 new tester; all tests categorized 2014-01-13 02:10:03 +01:00