Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression on devel - concat (and display) does not compile anymore #313

Closed
mratsim opened this issue Nov 4, 2018 · 0 comments
Closed

Comments

@mratsim
Copy link
Owner

mratsim commented Nov 4, 2018

nimble test and any proc that relies on concat including tensor display fails to compile on Nim devel.

Error is:

../src/tensor/display.nim(25, 27) template/generic instantiation of `disp3d` from here
../src/tensor/private/p_display.nim(94, 20) template/generic instantiation of `concat` from here
../src/tensor/shapeshifting.nim(211, 43) Error: type mismatch: got <HSlice[system.int, system.int], int literal(1)>
but expected one of:
proc `|`(a, b: typedesc): typedesc
  first type mismatch at position: 1
  required type: typedesc
  but expression '
0 .. pred(it, 1)' is of type: HSlice[system.int, system.int]

expression:
  0 .. pred(it, 1) | 1

Related: nim-lang/Nim@f6def42, nim-lang/Nim#8603 and nim-lang/Nim#8677

It seems like | is resolved too early and the compiler doesn't see:

# Procs to manage all integer, slice, SteppedSlice
proc `|`*(s: Slice[int], step: int): SteppedSlice {.noSideEffect, inline.}=
## Internal: A ``SteppedSlice`` constructor
## Input:
## - a slice
## - a step
## Returns:
## - a ``SteppedSlice``
return SteppedSlice(a: s.a, b: s.b, step: step)
proc `|`*(b, step: int): Step {.noSideEffect, inline.}=
## Internal: A ``Step`` constructor
##
## ``Step`` is a workaround due to operator precedence.
##
## [0..10|1] is interpreted as [0..(10|1)]
## Input:
## - the end of a slice range
## - a step
## Returns:
## - a ``Step``
return Step(b: b, step: step)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant