Commit graph

542 commits

Author SHA1 Message Date
ringabout
d950e5f3a8
remove nosinks hacks from compiler (#21469) 2023-03-04 20:07:33 +08:00
Jake Leahy
0a45543cc1
Specify that address is taken when converter takes a var parameter (#21391)
* Add test case

* closes #21247 Add the sfAddrTaken flag to var parameters in converters

This allows the JS backend to properly pass the parameter as a fat pointer
2023-02-21 12:27:12 +01:00
Bung
b68b28fd24
fix typeRel of typeDesc (#21227) 2023-01-09 07:34:51 +01:00
ringabout
761c5a0830
less verbose type mismatch messages (#21191)
* less verbose type mismatch messages

* Update compiler/types.nim

* fixes i386

* fixes i386
2022-12-28 20:54:15 +01:00
Jake Leahy
3d5dbf8f96
Fix nimsuggest not suggesting fields in when theres static parameters (#21189)
Don't check against empty arguments

Add test case
2022-12-28 07:35:11 +01:00
ringabout
f7c203fb6c
remove legacy code (#21134)
* remove legacy code

* fixes
2022-12-26 13:20:05 +01:00
Bung
c5a72ebddd
fix #16541 (#21148) 2022-12-22 06:16:25 +01:00
ringabout
b2c7019006
definite assignment analysis for let (#21024)
* draft for let daa

* patch

* fixes bugs

* errors for global let variable reassignments

* checkpoint

* out param accepts let

* add more tests

* add documentation

* merge tests
2022-12-06 10:19:12 +01:00
metagn
6d8cf25bd7
deprecate do: meaning do (): + misc cleanup (#20927)
* test disable do: block lambda lifting

* fix last test [skip ci]

* deprecate `do:` meaning `do ():` + misc cleanup

closes https://github.com/nim-lang/RFCs/issues/486

* oops

* fix

* no idea what could be causing nimsuggest failure other than this

* ensure ci works
2022-12-06 09:44:26 +01:00
Bung
5d469686b0
fix #20829 Regression in int64 type matching since (#21019)
fix #20829 Regression in int64 type matching
2022-12-06 07:44:54 +01:00
ringabout
feb0481ba3
Revert "fixes #20883; Unspecified generic on default value segfaults the compiler" (#21028)
Revert "fixes #20883; Unspecified generic on default value segfaults the compiler (#20917)"

This reverts commit 10b6e4f5b4.
2022-12-06 12:50:16 +08:00
ringabout
10b6e4f5b4
fixes #20883; Unspecified generic on default value segfaults the compiler (#20917)
test CI
2022-12-01 22:04:11 +01:00
Bung
658b28dc57
tyInt tyUint fit target int bit width (#20829) 2022-12-01 13:34:00 +01:00
ringabout
27a38a9fce
fix #13790; ptr char (+friends) should not implicitly convert to cstring (#20761)
* fix =#13790 ptr char (+friends) should not implicitly convert to cstring

* Apply suggestions from code review

* first round; compiles on windows

* nimPreviewSlimSystem

* conversion is unsafe, cast needed

* fixes more tests

* fixes asyncnet

* another try another error

* last one

* true

* one more

* why bugs didn't show at once

* add `nimPreviewCstringConversion` switch

* typo

Co-authored-by: xflywind <43030857+xflywind@users.noreply.github.com>
2022-11-24 07:49:23 +01:00
Bung
bae0fb720a
fix #19149 Invalid codegen when returning var tuple from a template (#20762)
* fix #19149 Invalid codegen when returning var tuple from a template

* fix type
2022-11-06 11:49:34 +01:00
Bung
0510a2be0d
fix #19700 Crash when passing a template to a generic functio… (#20567)
fix nim-lang#19700 Crash when passing a template to a generic function expecting a procedure
2022-10-15 07:15:58 +02:00
Bung
083ea8f10c
fix #7446 Generics: type mismatch 'SomeunsignedInt or Natural' (#20522)
* fix #7446 Generics: type mismatch 'SomeunsignedInt or Natural'

* try fix
2022-10-11 11:42:49 +02:00
Andreas Rumpf
0d23419e68
DAA and 'out' parameters (#20506)
* DAA and 'out' parameters

* progress

* documented strictDefs and out parameters

* docs, tests and a bugfix

* fixes silly regression
2022-10-06 17:08:41 +02:00
Andrey Makarov
0f555110e6
Markdown code blocks part 6 (#20292) 2022-08-31 19:39:02 -04:00
ringabout
1182216381
remove a special case in sigmatch; distinct pointer types no longer match nil type (#20251)
* remove a special case in sigmatch; distinct pointer types no longer match `nil` type

* add tests

* fixes tests

* Update changelog.md

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
2022-08-23 19:27:20 +02:00
flywind
7f6e800caf
move assertions out of system (#19599) 2022-03-23 20:34:53 +01:00
Jason Beetham
1830a3b505
No longer segfault when using a typeclass with a self referencing type (#19467) 2022-02-02 09:38:21 +01:00
Jason Beetham
7bdfeb7819
Fixed concept constraints for static types (#19391) 2022-01-15 09:24:23 +01:00
Jason Beetham
a93f6e7acc
Generic parameters now can constrain statics in type definitions (#19362)
* Parameters now can constrain static in type definitions

resolved regression with generic procedures

* Update compiler/sigmatch.nim

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2022-01-14 00:39:55 +08:00
Andreas Rumpf
d584dd5b99
fixes #19015 [backport:1.6] (#19204) 2021-12-04 07:42:58 +01:00
Andreas Rumpf
cddf8ec6f6
implements https://github.com/nim-lang/RFCs/issues/407 (#18793) 2021-09-03 21:52:24 +02:00
Andreas Rumpf
a7cae2bda2
fixes #16325 [backport:1.4] (#18784) 2021-09-02 17:15:11 +02:00
Timothee Cour
f2910077ac
sigmatch: support optional params with last block arg(s) (#18631)
* sigmatch: support optional params with last block arg
* add tests
* works with multiple block args
* cleanup
* address comment
2021-08-20 10:13:03 +02:00
Andreas Rumpf
a273ea70e8
implements overloadable enum values; WIP (#18470)
* implements overloadable enum values
* simpler code
2021-07-28 12:46:28 +02:00
Andreas Rumpf
fa0209609d
fixes #18565 (#18593)
* fixes #18565
2021-07-27 09:36:19 +02:00
Jason Beetham
252eea8cae
Make procedure mismatch more informative with pragma/call convention mismatches (#18384)
* Added more concise calling convention/pragma mismatch messages
* Now only adds callConvMsg/lock message  when sensible
* Fixed message formatting
* Added tests, and fixed some bugs
* Tests joined, and always indenting
* More tests and more bug fixes
* Fixed first test in tprocmismatch
* Using var param for writting mismatches
* Better logic for handling proc type rel and conv/pragma mismatch
* Refactored getProcConvMismatch
* Fixed callConv message formatting
* Fixed test for proper message
* Cleanup to address issues
* getProcConvMismatch now returns tuple, and reformatted code
2021-07-06 07:28:38 +02:00
Andreas Rumpf
97fc95012d
fixes #16270 (#18388) 2021-06-29 15:34:39 +02:00
Tanguy Cizain
8e124da75d
fix range to unsigned conversion (#17754) 2021-04-17 15:34:00 +02:00
Timothee Cour
5c9c1988f6
-d:nimDebug: calls doAssert false instead of quit (#17739) 2021-04-17 11:49:54 +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
Timothee Cour
6c5872c169
--nilseqs is now a deprecated noop (#17211)
* --nilseqs is now a deprecated noop

* fix tests; fix: future => sugar
2021-03-01 20:59:43 +01: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
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
flywind
1e320bc8c5
[docs minor]space for code-block (#16266)
* [docs minor]space for code-block

* correct more errors

* to runnableExamples

* add newline
2020-12-06 09:54:32 +01:00
flywind
4213f7a6c9
rename: stmt -> typed and expr -> untyped (#15989)
* stmt -> typed

* expr -> untyped

* minor
2020-11-16 14:19:26 +00:00
Miran
bbe49a14ae
Correct all eggs (#15906)
* "eg" is a misspelled "egg", "e.g." is "exempli gratia"
* Also, "ie" is "i.e.".
2020-11-10 21:53:25 +01:00
cooldome
4c19c5dfae
fix static[Slice[T]] as argument issue (#15842) 2020-11-04 19:52:53 +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
Andreas Rumpf
c664fb2843
sigmatch: hotfix [backport] (#15565) 2020-10-14 09:55:47 +02:00
jcosborn
e56d50d747
fix infinite recursion in typeRel (#15241)
* fix generic constraints

Co-authored-by: James Osborn <osborn@Jamess-MacBook-Pro.local>
2020-09-18 11:21:37 +02:00
Clyybber
13e659cfec
Big compiler Cleanup (#14777) 2020-08-28 22:18:09 +02:00
Clyybber
fb58066b61
Fix #5691 (#15158)
* Fix #5691
* Cleanup and thoughts
* Use scope approach
* Seperate defined/declared/declaredInScope magics
* Fix declaredInScope
* Update spec accordingly
2020-08-27 15:50:59 +02:00
jcosborn
d11933ad99
fix some issues overloading with generics and inheritance (#15211)
* fix some issues overloading with generics and inheritance

* fix passing procs with subtype matches
2020-08-27 12:56:38 +02:00
jcosborn
e194cb41a4
fix overloading issue with generic invocation (#15135)
* fix overloading issue with generic alias

* add test for inheritance depth
2020-08-18 08:23:19 +02:00