Commit Graph

15 Commits

Author SHA1 Message Date
flywind
7f6e800caf move assertions out of system (#19599) 2022-03-23 20:34:53 +01:00
Andreas Rumpf
6ea6225523 bugfix: varargs count as open arrays (#19447) 2022-01-25 08:08:22 +01:00
Andreas Rumpf
ac37eed5a2 fixes #16617 [backport] (#19300) 2021-12-31 09:21:30 +01:00
Jason Beetham
ee2eb5cae2 Fix subranges of distinct types (#18816) [backport] 2021-09-07 17:11:08 +02:00
Timothee Cour
7e94420847 cString => cSourceString; tyCString => tyCstring so that error msgs show cstring, not cString (#17744) 2021-04-17 11:14:09 +02:00
Timothee Cour
ceadf54d76 iterable[T] (#17196)
* fix failing test toSeq in manual which now works
* changelog
* reject proc fn(a: iterable)
* add iterable to spec
* remove MCS/UFCS limitation that now works
2021-04-11 14:25:41 +02:00
flywind
e406e28738 fix #16898 #17621 (#17628)
* fix #16898
* fix #17621

* Update compiler/semtypes.nim
2021-04-06 18:01:54 +02:00
Andreas Rumpf
6278b5d89a new-style concepts implementation, WIP (#15251)
* fixes #15210 [backport:1.2]

* make tests green
* make ordinal work
* makes Swapable test compile
* make Indexable example work
* concepts: 'self' is now 'Self'
* concepts: make Dictionary example compile
* document the new concept implementation
* concepts: make typeDesc work properly
* concepts: allow documentation comments (d'oh)
2021-02-24 13:17:33 +01:00
Andreas Rumpf
d9038ed792 fixes #15671 [backport:1.4] (#15690)
* fixes #15671 [backport:1.4]

* progress
2020-11-20 18:14:15 +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
Andreas Rumpf
4e438f9096 const view types; fixes some cases from https://github.com/nim-lang/Nim/issues/15428 (#15488) 2020-10-05 18:31:46 +02:00
Andreas Rumpf
86d7b63e2a better support for view types (#15436)
* you can put borrows into tables

* enforces mutating views only mutate mutable data
2020-09-30 20:44:18 +02:00
Andreas Rumpf
4058801607 spec for view types (#15424)
* spec for view types
* spec additions
* refactoring; there are two different kinds of views
* refactorings and spec additions
* enforce that view types are initialized
* enforce borrowing from the first formal parameter
* enforce lifetimes for borrowing of locals
* typo in the manual
* clarify in the implementation what a borrow operation really is
2020-09-29 23:42:38 +02:00
Andreas Rumpf
217675cf84 borrow checking refinements (#15290)
* added basic borrowing test
2020-09-09 14:19:22 +02:00
Andreas Rumpf
10988d4840 borrow checking (#15282)
* refactoring: move procs to typeallowed.nim
* frontend preparations for first class openArray support
* prepare the code generator for first class openArray
* code generation for first class openArray; WIP
* code generation for open arrays, progress
* added isViewType proc
* preparations for borrow checking
* added borrow checking to the front end
2020-09-09 07:32:03 +02:00