fixes #17958 In `transf`, conversions in subscript expressions are skipped (with `skipConv`'s rules). This is because array indexing can produce conversions to the range type that is the array's index type, which causes a `RangeDefect` rather than an `IndexDefect` (and also `--rangeChecks` and `--indexChecks` are both considered). However this causes problems when explicit conversions are used, between types of different bitsizes, because those also get skipped. To fix this, we only skip the conversion if: * it's a hidden (implicit) conversion * it's a range check conversion (produces `nkChckRange`) * the subscript is on an array type and the result type of the conversion has the same bounds as the array index type And `skipConv` rules also still apply (int/float classification). Another idea would be to prevent the implicit conversion to the array index type from being generated. But there is no good way to do this: matching to the base type instead prevents types like `uint32` from implicitly converting (i.e. it can convert to `range[0..3]` but not `int`), and analyzing whether this is an array bound check is easier in `transf`, since `sigmatch` just produces a type conversion. The rules for skipping the conversion could also receive some other tweaks: We could add a rule that changing bitsizes also doesn't skip the conversion, but this breaks the `uint32` case. We could simplify it to only removing implicit skips to specifically fix #17958, but this is wrong in general. We could also add something like `nkChckIndex` that generates index errors instead but this is weird when it doesn't have access to the collection type and it might be overkill.
This directory contains the test cases.
Each test must have a filename of the form: t*.nim
Note: Testament is only aware of tests under a directory (eg tests/foo/) and will ignore
top-level tests like tests/tbar.nim.
Specs
Each test can contain a spec in a discard """ ... """ block.
Check out the parseSpec procedure in the specs module for a full and reliable reference
action
Specifies what action this test should take.
Default: run
Options:
compile- compiles the module and fails the test if compilations fails.run- compiles and runs the module, fails the test if compilation or execution of test code fails.reject- compiles the module and fails the test if compilation succeeds.
There are certain spec keys that imply run, including output and
outputsub.
Categories
Each folder under this directory represents a test category, which can be
tested by running koch tests pcat <category> (or cat to avoid parallel
testing, which is slower).
The folder dll contains simple DLL tests.
The folder realtimeGC contains a test for validating that the realtime GC
can run properly without linking against the nimrtl.dll/so.