Open mothfuzz opened 1 week ago
!nim c
type Array2d[W, H: static[int]] = array[H, array[W, int]]
proc normal(a: Array2d, b: Array2d) =
echo len(a), ", ", len(b)
proc dist(a: Array2d, b: distinct Array2d) =
echo len(a), ", ", len(b)
proc doubleDist(a: distinct Array2d, b: distinct Array2d) =
echo len(a), ", ", len(b)
proc explicit[A, B: distinct Array2d](a: A, b: B) =
echo len(a), ", ", len(b)
let a = [[0, 1]]
let b = [[0, 1, 2]]
explicit(a, b)
doubleDist(a, b)
dist(a, b)
normal(a, b)
0 (0 bytes)
```cpp
```
2024-10-22T01:52:35
2024-10-22T01:52:35
0 (0 bytes)
```cpp
```
2024-10-22T01:52:39
2024-10-22T01:52:40
0 (0 bytes)
```cpp
```
2024-10-22T01:52:43
2024-10-22T01:52:43
0 (0 bytes)
```cpp
```
2024-10-22T01:52:47
2024-10-22T01:52:47
0 (0 bytes)
```cpp
```
2024-10-22T01:52:50
2024-10-22T01:52:50
0 (0 bytes)
```cpp
```
2024-10-22T01:52:54
2024-10-22T01:52:54
0 (0 bytes)
```cpp
```
2024-10-22T01:52:57
2024-10-22T01:52:57
0 (0 bytes)
```cpp
```
2024-10-22T01:53:00
2024-10-22T01:53:00
11.4.0
14.0.0
20.4
2024-10-22T01:52:05Z
1
nim c --run -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim
:robot: Bug found in 28 mins
bisecting 8
commits at 0
commits per second
static
parameters in tyCompositeTypeClass
keep the id of the original param, which universally matches that parameter to the first matching value.
IMO the solution is to add a type binding layer when matching tyCompositeTypeClass
in sigmatch like in #24250, but #24250 needs a slight modification: only generic parameters belonging to the matched candidate should be matched in every previous binding layer, other generic parameters (like in this case, W
and H
) should only be matched in the current layer.
Description
When defining a custom type alias or type class, the
distinct
keyword in argument position seems to not do anything as implied in the manual. It neither works with explicit nor implicit generics.Nim Version
Nim Compiler Version 2.2.0 [Windows: amd64] Compiled at 2024-10-02 Copyright (c) 2006-2024 by Andreas Rumpf
Current Output
Expected Output
Known Workarounds
No response
Additional Information
No response