summary refs log tree commit diff stats
path: root/tests/tuples
Commit message (Collapse)AuthorAgeFilesLines
* fix wrong subtype relation in tuples & infer some conversions (#23228)metagn2024-01-182-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | fixes #18125 Previously a tuple type like `(T, int)` would match an expected tuple type `(U, int)` if `T` is a subtype of `U`. This is wrong since the codegen does not handle type conversions of individual tuple elements in a type conversion of an entire tuple. For this reason the compiler already does not accept `(float, int)` for a matched type `(int, int)`, however the code that checked for which relations are unacceptable checked for `< isSubtype` rather than `<= isSubtype`, so subtypes were not included in the unacceptable relations. Update: Now only considered unacceptable when inheritance is used, as in [`paramTypesMatch`](https://github.com/nim-lang/Nim/blob/3379d26629f30e6be8d303a36e220d1039eb4551/compiler/sigmatch.nim#L2252-L2254). Ideally subtype relations that don't need conversions, like `nil`, `seq[empty]`, `range[0..5]` etc would be their own relation `isConcreteSubtype` (which would also allow us to differentiate with `openArray[T]`), but this is too big of a refactor for now. To compensate for this making things like `let x: (Parent, int) = (Child(), 0)` not compile (they would crash codegen before anyway but should still work in principle), type inference for tuple constructors is updated such that they call `fitNode` on the fields and their expected types, so a type conversion is generated for the individual subtype element.
* round out tuple unpacking assignment, support underscores (#22537)metagn2023-08-241-0/+12
| | | | | | | | | | | | | | | * round out tuple unpacking assignment, support underscores fixes #18710 * fix test messages * use discard instead of continue Co-authored-by: Andreas Rumpf <rumpf_a@web.de> --------- Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* fixes #22049; fixes #22054; implicit conversion keeps varness (#22097)ringabout2023-06-161-0/+26
| | | | | | | | | | | | | | | | | | | | | * fixes #22054; codegen for var tuples conv * rethink fixes * add test cases * templates only * fixes var tuples * keep varness no matter what * fixes typ.isNil * make it work for generics * restore isSubrange * add a test case as requested
* tuple unpacking for vars as just sugar, allowing nesting (#21563)metagn2023-03-282-0/+12
| | | | | | | | | | | | | | | | | | | * tuple unpacking for vars as just sugar, allowing nesting * set temp symbol AST * hopeful fix some issues, add test for #19364 * always use temp for consts * document, fix small issue * fix manual indentation * actually fix manual * use helper proc * don't resem temp tuple assignment
* closes #16331; add testcase (#20730)ringabout2022-11-021-0/+12
|
* style usages part one (openarray => openArray) (#19321)flywind2022-01-041-2/+2
| | | | | * style usages (openArray) * revert doc changes
* Fixed const tuples in inferred generics (#18598)Jason Beetham2021-07-271-0/+14
|
* close #7012 add testcase (#17537)flywind2021-03-271-0/+7
|
* tests/tuples/ttuples_issues.nim: test on all backends + various improvements ↵Timothee Cour2021-02-021-81/+118
| | | | | | | (#16907) * improve tests/tuples/ttuples_issues.nim: test on all backends * address comments
* cleanup old codes (#16173)flywind2020-11-301-9/+2
|
* Fix #14911 (#14922) [backport]Clyybber2020-07-071-1/+8
| | | | | | | * Fix #14911 * Add testcase * Fix test
* fixes #14112, tests for #12892, #12671, #11697 (#14125)hlaaftana2020-04-261-0/+8
|
* fix several typos in documentation and comments (#12553)Nindaleth2019-10-301-2/+2
|
* Fix spellings (#12277) [backport]Federico Ceratto2019-09-271-2/+2
|
* Tuple error message (#11141); fixes #3211Arne Döring2019-05-152-0/+10
|
* Merge pull request #11159 from JasperJenkins/const-named-tuple-unpackAndreas Rumpf2019-05-082-1/+21
|\ | | | | Const named tuple unpacking
| * enable t9177.Jasper Jenkins2019-05-011-1/+0
| |
| * const named tuple unpackingJasper Jenkins2019-05-011-0/+21
| |
* | Fix loop tuple unpacking in templates (#11174)nc-x2019-05-051-0/+9
|/ | | | | | * Fix loop tuple unpacking in templates * Add test
* Fixes #10727. (#10728)deech2019-02-251-1/+5
|
* Tuple unpacking now works for `for` vars (#10152)Neelesh Chandola2019-02-231-0/+39
| | | | | | | | * Tuple unpacking now works for `for` vars * Give error if length of tuple vars != length of tuple * Fix error message showing wrong tuple length * unpacking now works now for mutable items * Update changelog
* make tests green againAndreas Rumpf2019-02-081-0/+1
|
* Fix wrong result in tuple assignment (#9340)LemonBoy2019-02-081-0/+15
| | | Fixes #9177
* remove deprecated modules (#10215)Miran2019-01-071-1/+0
| | | | | | | | | | | | | | | | | | * removed from `compiler`: * lists (deprecated 2 years ago) * removed from `lib` (all deprecated 3 years ago): * ssl * matchers * httpserver * removed from `lib/deprecated`: * unsigned * actors (and three accompanying tests) * parseurl * moved to `lib/deprecated`: * securehash (the reason for not directly removing - it was deprecated (only) one year ago)
* Const tuple unpacking: add tests (#10100)ee72018-12-271-0/+16
|
* lots of small changesArne Döring2018-12-111-1/+1
|
* require errormsg to be specified before file.Arne Döring2018-12-111-2/+1
|
* Merge tests into a larger file (part 8 of ∞) (#9583)Miran2018-11-0611-214/+213
| | | | | | | | * merge tuple tests * merge trmacros tests * merge template tests
* fixes more nil handling regressionsAraq2018-08-132-14/+14
|
* rename SomeReal to SomeFloat (#7617)Arne Döring2018-04-151-4/+4
| | | | | * rename SomeReal to SomeFloat * added changelog entry
* introduce nkTupleConstr AST node for unary tuple construction; breaking changeAndreas Rumpf2018-04-131-1/+13
|
* make tests green againAraq2017-12-151-1/+1
|
* Remove expr/stmt (#5857)Arne Döring2017-07-251-1/+1
|
* fixes tuple unpacking regressionAndreas Rumpf2017-04-261-0/+2
|
* Fix for #5695 make subscript operator overloadable for tuples (#5749)cooldome2017-04-241-0/+40
|
* fix: generic tuples instantiations were cached incorrectlyAndreas Rumpf2016-07-281-0/+4
|
* Handle tuples with unnamed fields, symbols, and more. Less duplication.Matthew Baulch2016-07-151-0/+4
|
* Use target field types in tuple conversions.Matthew Baulch2016-07-141-0/+19
|
* fixes #3579Andreas Rumpf2016-06-051-1/+1
|
* SpellcheckFederico Ceratto2016-02-291-2/+2
|
* tuple unpacking works in a non-var/let contextAraq2015-08-211-0/+32
|
* s/procedure/routine/ in tests.Dominik Picheta2015-06-051-1/+1
|
* Got rid of errUndeclaredProcedureField.Dominik Picheta2015-06-041-1/+1
|
* Fixes #2584Dominik Picheta2015-06-041-1/+1
| | | | | Better compiler errors for accessing undeclared fields, calling undeclared procedures and procedure fields.
* made test greenAraq2015-05-031-0/+46
|
* fixes regression caused by code cleanupsAraq2015-04-291-0/+766
|
* Adds test file, for bug #1986Joseph Turner2015-04-091-0/+10
|
* fixes #2369Araq2015-03-211-0/+17
|
* fixes #2121Araq2015-02-141-0/+9
|
* typo; last commit fixes #1910Araq2015-01-181-1/+1
|