Commit Graph

38 Commits

Author SHA1 Message Date
metagn
480e98c479 resolve unambiguous enum symchoices from local scope, error on rest (#22606)
fixes #22598, properly fixes #21887 and fixes test case issue number

When an enum field sym choice has to choose a type, check if its name is
ambiguous in the local scope, then check if the first symbol found in
the local scope is the first symbol in the sym choice. If so, choose
that symbol. Otherwise, give an ambiguous identifier error.

The dependence on the local scope implies this will always give
ambiguity errors for unpicked enum symchoices from generics and
templates and macros from other scopes. We can change `not
isAmbiguous(...) and foundSym == first` to `not (isAmbiguous(...) and
foundSym == first)` to make it so they never give ambiguity errors, and
always pick the first symbol in the symchoice. I can do this if this is
preferred, but no code from CI seems affected.
2023-09-03 13:59:03 +02:00
ringabout
ab4d044a81 fixes #21887; Type conversion on overloaded enum field does not always call (#21908)
* fixes #21887; Type conversion on overloaded enum field does not always call

* remove comments

* add a test case

* restrict it to enums
2023-05-26 09:24:43 +02:00
ringabout
761b927e47 fixes #21863; Incorrect enum field access can cause internal error (#21886)
fixes 21863; Incorrect enum field access can cause internal error
2023-05-24 07:43:30 +02:00
ringabout
8cf5643621 fixes #21280; Enum with int64.high() value crashes compiler (#21285)
* fixes #21280; Enum with int64.high() value crashes compiler

* Update tests/enum/tenum.nim

* Update tests/enum/tenum.nim

* fixes tests

* Update tests/enum/tenum.nim

---------

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2023-05-06 21:38:17 +02:00
ringabout
51f410e1d5 megatest now checks refc too (#21341)
* megatest now checks refc too

* fixes refc
2023-02-09 16:14:39 -05:00
ringabout
81b7f9108f fixes #21207; reports redefinition error in the definition of enums (#21217)
* fixes #21207;  reports redefinition in the enums

* add a test
2023-01-03 08:15:10 +01:00
ringabout
93b085a57a closes #12589; add testcase (#20769)
* fixes #12589; add testcase

* fixes i386

* i386
2022-11-06 11:46:51 +01:00
metagn
cfff454cf9 closed ambiguous enum defaults to first overload (#20457)
* closed ambiguous enum defaults to first overload

* add warning

* turn to hint

* work around config
2022-10-01 13:30:23 +02:00
metagn
5ebd1248df overloadable enums no longer experimental (#20298)
depends on #20126
2022-09-05 23:38:38 +02:00
metagn
a6189fbb98 only allow enums to overload enums + extra test (#20126)
mirror behavior without overloadableEnums
2022-09-03 09:53:31 +02:00
flywind
1807de38e5 add testcase for #16462 (#19692) 2022-04-07 20:57:50 +02:00
Andreas Rumpf
6f15af41a7 fixes a regression caused by overloadable enums even though they're opt-in (#18970) 2021-10-07 15:07:24 +02:00
Andreas Rumpf
06ff0e9624 fixes #18769 (#18790) 2021-09-03 15:18:55 +02:00
flywind
f0c6593412 add testcase for overloadable_enums (#18722)
* add testcase for overloadable_enums

* link
2021-08-21 08:21:06 +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
Timothee Cour
ef121f3b99 followup #17876: remove annoying enum name clashes in tests/enum/tenum.nim (#18291) 2021-06-17 16:19:16 -07:00
Timothee Cour
840e13deb7 type with same name in different scope now works (#17710)
* type with same name in different scope now works
* fix tests/enum/tenum.nim which was wrong because it was affected by this bug
2021-04-14 08:50:15 +02:00
flywind
27eb19cc48 fix #15145 (#15816) 2020-11-02 08:56:51 +01:00
cooldome
f8cac6bbbc fix #15752 (#15754) 2020-10-28 00:09:26 +01:00
Jasper Jenkins
9474a818af fix enumtostr crash for enum-range (#13035) 2020-01-05 09:18:14 +01:00
Miran
e7878c0d08 add tests for recently closed issues (#10722) 2019-02-23 10:41:35 +01:00
Arne Döring
28394153ab 32 bit fixes (#10608) 2019-02-13 23:30:14 +01:00
Neelesh Chandola
c5ad4c10cb Deprecated pragma is now supported on enum fields (#10113)
* {.deprecated.} pragma is now supported for enum fields
* Add tests
* Simplify code
2018-12-30 09:43:59 +01:00
Arne Döring
1105d03644 require errormsg to be specified before file. 2018-12-11 21:23:21 +01:00
Timothee Cour
eb946f37a7 fixes #8671; show helpful msg (lookup symbol, eg iterator) on 'attempting to call undeclared routine' error (#8786) 2018-10-14 01:16:04 +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
Araq
2f7b979e38 fixes #8066 2018-08-31 00:30:19 +02:00
Jacek Sieka
72dfe176f5 remove dead code elimination option (#7669) 2018-04-23 11:02:38 +02:00
Silvio
51cd3bd86f Fixes #5062 (#5527); JS: holes in enums 2017-03-15 10:33:37 +01:00
Araq
700c024e13 fixes #5148 2016-12-29 19:32:43 +01:00
Yuriy Glukhov
f46d40cb37 Added a test case 2016-05-18 13:51:07 +03:00
Aman Gupta
2240fd3f3f add tfile/tline assertions for template expansion file/line 2015-10-06 15:47:07 -07: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
Dominik Picheta
ad6ad5d8d0 s/procedure/routine/ in tests. 2015-06-05 14:53:49 +01:00
Dominik Picheta
22f6017ab8 Fixes #2584
Better compiler errors for accessing undeclared fields, calling undeclared
procedures and procedure fields.
2015-06-04 13:55:48 +01:00
Araq
ee57bb3e3e fixes --gc:none regression; made some tests green 2015-03-10 12:32:47 +01:00
Dominik Picheta
53b8d6281d Fixes tenumitems test. 2014-08-16 01:15:36 +01:00
Araq
20b5f31c03 new tester; all tests categorized 2014-01-13 02:10:03 +01:00