Commit Graph

89 Commits

Author SHA1 Message Date
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
73a8b950cb big steps torwards an efficient, simple IC implementation (#16543)
* reworked ID handling
* the packed AST now has its own ID mechanism
* basic serialization code works
* extract rodfiles to its own module
* rodfiles: store and compare configs
* rodfiles: store dependencies
* store config at the end
* precise dependency tracking
* dependency tracking for rodfiles
* completed loading of PSym, PType, etc
* removed dead code
* bugfix: do not realloc seqs when taking addr into an element
* make IC opt-in for now
* makes tcompilerapi green again
* final cleanups

Co-authored-by: Andy Davidoff <github@andy.disruptek.com>
2021-01-02 07:30:39 +01:00
Andreas Rumpf
226595515c explicit ID generation for easier IC (#15559)
* refactoring: idents don't need inheritance
* refactoring: adding an IdGenerator (part 1)
* refactoring: adding an IdGenerator (part 2)
* refactoring: adding an IdGenerator (part 3)
* refactoring: adding an IdGenerator (part 4)
* refactoring: adding an IdGenerator (part 5)
* refactoring: adding an IdGenerator (part 5)
* IdGenerator must be a ref type; hello world works again
* make bootstrapping work again
* progress: add back the 'exactReplica' ideas
* added back the missing exactReplica hacks
* make tcompilerapi work again
* make important packages green
* attempt to fix the build for 32 bit machines (probably need a better solution here)
2020-10-25 08:50:47 +01:00
Clyybber
35ff17410f Expand hoisted default params in sem (#15270)
* Expand hoisted default params in sem
Introduce ast.newTree{I,IT}
Add test for default params in procs

* Cleanup

* Simplify hoist transformation and expand test
2020-09-05 22:01:47 +02:00
Timothee Cour
0c56eeda0e expr => untyped; stmt => typed (#14804)
* expr => untyped; stmt => typed

* changelog + comment
2020-06-25 10:22:08 +02:00
Timothee Cour
e30a08103d remove tyOpt, mOpt (#14636)
* remove tyOpt, mOpt

* fixup
2020-06-12 11:03:52 +02:00
zah
e50441ab33 Fix typeSym.getImpl for ref types (#13752)
* Fix typeSym.getImpl for ref types

* Fix a codegen issue affecting the test suite of nim-beacon-chain

* Fix tests/stdlib/tjsonmacro

To understand the fix better it may help to take a look
at the history of the replaced code.

The nil check that is removed in this commit was introduced
in another fix that failed to identify the root cause of the
issue - namely that we allow an object type to exist for which
no ast is present:

https://github.com/nim-lang/Nim/pull/9601/files

The original intention of the code is more obvious here:

https://github.com/nim-lang/Nim/pull/9538/files
2020-03-26 09:26:19 +01:00
Clyybber
7e747d11c6 Cosmetic compiler cleanup (#12718)
* Cleanup compiler code base

* Unify add calls

* Unify len invocations

* Unify range operators

* Fix oversight

* Remove {.procvar.} pragma

* initCandidate -> newCandidate where reasonable

* Unify safeLen calls
2019-11-28 17:13:04 +01:00
Timothee Cour
dfe5d115fb fixes #12663 staticRead now creates a dependency for rebuilds (#12731) [backport]
* fix #12663 staticRead
* address comments
2019-11-25 14:44:13 +01:00
Jasper Jenkins
40c5175145 fix range.getType crash 2019-09-05 15:56:44 -07:00
Araq
07d465ca42 [refactoring] remove unused imports in the compiler and in some stdlib modules 2019-07-18 00:36:03 +02:00
Araq
c94647aeca styleCheck: make the compiler and large parts of the stdlib compatible with --styleCheck:error 2019-07-10 12:42:41 +02:00
Arne Döring
b92fd30282 rename tyExpr/tyStmt to tyUntyped/tyTyped (#11227) 2019-05-11 10:11:08 +02:00
Andreas Rumpf
721bf7188b code cleanup: there is no tyOptRef 2019-02-22 19:42:11 +01:00
Andreas Rumpf
b5eed8ab3f make code more readable 2019-02-18 10:30:30 +01:00
jcosborn
fc740c54ec fixes #9600 (#9601) 2018-11-07 08:40:00 +01:00
jcosborn
69c0a9c6fb getTypeImpl now returns pragmas for object types (#9538) 2018-10-30 06:41:12 +01:00
Araq
f9eec2aa1e fixes #9532 2018-10-28 13:23:27 +01:00
LemonBoy
0ead36dae6 Unchecked arrays now have their own type (#9267) 2018-10-10 21:03:18 +02:00
LemonBoy
8a1055adce Fix range type construction in the VM (#9205)
The `range[X,Y]` representation is wrong, we use `range[X .. Y]`
instead.

Fixes #9194
2018-10-09 15:51:49 +02:00
Andreas Rumpf
86556ebfdb compiler refactoring; use typesafe path handing; docgen: render symbols between modules 2018-09-07 19:21:16 +02:00
cooldome
dec97924a4 Custom pragmas in proc types (#8205) 2018-07-09 12:11:03 +02:00
Andreas Rumpf
40ec7be45c refactoring: remove idents.legacy global variable and pass the IdentCache around explicitly 2018-05-27 22:09:15 +02:00
Andreas Rumpf
669a564492 remove more global variables in the Nim compiler 2018-05-27 11:10:56 +02:00
Andreas Rumpf
bf6c2c5ccf preparations of making compiler/msgs.nim free of global variables 2018-05-17 15:21:22 +02:00
Araq
2a7fc84c86 remove ast.emptyNode global; cleanup configuration.nim 2018-05-16 03:06:07 +02:00
Andreas Rumpf
fedc136985 transf and vmgen compile again 2018-05-12 09:38:41 +02:00
Varriount
822d2b5085 Fix the return value of GetType and friends when given a var T type. (#7701) 2018-04-27 21:35:41 +02:00
Andreas Rumpf
47335aab41 introduce nkTupleConstr AST node for unary tuple construction; breaking change 2018-04-13 17:45:58 +02:00
Andreas Rumpf
e4081a7201 preparations for language extensions: 'sink' and 'lent' types 2018-01-07 23:09:26 +01:00
jcosborn
96a5062b8c modify getTypeImpl to reduce result to final implementation (#6891)
* added test case for getTypeImpl
* modify getTypeImpl to reduce result to final implementation
2017-12-09 13:07:37 +01:00
jcosborn
35d7a99b6a fix getTypeInst for tyGenericInst (#6868) 2017-12-04 17:37:25 +01:00
Andreas Rumpf
70ea45cdba deprecated unary '<' 2017-10-29 08:37:13 +01:00
Andreas Rumpf
02ff5f596c implemented new experimental scriptable import mechanism 2017-10-01 23:38:23 +02:00
Andreas Rumpf
f7f3a25be8 first steps of making 'opt' a first class type for Nim 2017-09-25 13:19:36 +02:00
Andreas Rumpf
e879da5791 some work to make 'opt' a first class type 2017-09-24 11:21:52 +02:00
Yuriy Glukhov
0755f902dd Corrected tuple type to nkPar for unnamed tuples on getType (#6172) 2017-08-03 10:37:47 +02:00
jcosborn
ec50dab57d fixed macros.getTypeImpl for a symbol of type tyGenericBody (#5788) (#5812)
* fixed macros.getTypeImpl for a symbol of type tyGenericBody
* added test case and commented test code
2017-05-14 15:08:41 +02:00
Zahary Karadjov
0b0a3e5f20 support derived values in non-generic user type classes 2017-03-24 16:58:15 +02:00
Zahary Karadjov
8cd5f1f8f5 introduce tyInferred for the unbound concept type params
* Why is tyInferred needed?

The bindings in TCandidate are capable of inferring types within a single
call expression. In concepts, we need to infer types in the same way, but
across the whole body of the concept.

Previously, once a concept type param was inferred, it was destructively
mutated using t.assignType, but this proved to be problematic in the presence
of overloads, because the bindings established while a non-matching overload
is tested must be reverted/forgotten. tyInferred offers a non-destructive way to
keep track of the inference progress.

While introducing new types usually requires a lot of code paths in the compiler
to updated, currently tyInferred is only a short-lived type within the concept body
pass and it's unlikely to introduce breakage elsewhere in the compiler.
2017-03-24 16:58:15 +02:00
jcosborn
3bffb3ba35 fix getTypeImpl for tyEnum (#5568)
* fixed getTypeImpl for tyEnum
* fixed getType for enum and updated release notes about change
2017-03-19 20:34:27 +01:00
Fabian Keller
e2567e2e03 Fix sigsegv in getTypeImpl for unnamed tuple (#5440)
avoid sigsegv in getTypeImpl for unnamed tuple; fixes #4862
2017-03-02 15:30:19 +01:00
Araq
9d488261df added system.gorgeEx that includes the exitCode; refs #4874; fixes #1994 2017-01-07 02:38:26 +01:00
Araq
c166394024 fixes #5131 2016-12-20 22:42:25 +01:00
Araq
414c2decbe Merge branch 'devel' into sighashes 2016-12-13 12:18:45 +01:00
Araq
dc5e4b018b macros.getType: do not copy symbols if not necessary 2016-12-07 20:08:03 +01:00
Araq
e6c5622aa7 removed tyArrayConstr completely from the compiler; introduced tyAlias instead in preparation for further bugfixes 2016-11-14 23:18:30 +01:00
Andreas Rumpf
6fd27a8a08 Merge pull request #4945 from arnetheduck/cleanup-tyXxx
Cleanup ty xxx
2016-10-24 19:20:02 +02:00
Andreas Rumpf
cceb6c625c Merge pull request #4872 from flyx/gorgefix
Fixes #4871
2016-10-24 17:40:32 +02:00
Jacek Sieka
f5c3eb6a25 clean up tyMutable remnants 2016-10-24 23:30:10 +08:00