mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
fixes #23568, fixes #23310 In #23091 `semFinishOperands` was changed to not be called for `mArrGet` and `mArrPut`, presumably in preparation for #23188 (not sure why it was needed in #23091, maybe they got mixed together), since the compiler handles these later and needs the first argument to not be completely "typed" since brackets can serve as explicit generic instantiations in which case the first argument would have to be an unresolved generic proc (not accepted by `finishOperand`). In this PR we just make it so `mArrGet` and `mArrPut` specifically skip calling `finishOperand` on the first argument. This way the generic arguments in the explicit instantiation get typed, but not the unresolved generic proc.
25 lines
715 B
Nim
25 lines
715 B
Nim
block: # issue #23568
|
|
type G[T] = object
|
|
j: T
|
|
proc s[T](u: int) = discard
|
|
proc s[T]() = discard
|
|
proc c(e: int | int): G[G[G[int]]] = s[G[G[int]]]()
|
|
discard c(0)
|
|
|
|
import std/options
|
|
|
|
block: # issue #23310
|
|
type
|
|
BID = string or uint64
|
|
Future[T] = ref object of RootObj
|
|
internalValue: T
|
|
InternalRaisesFuture[T] = ref object of Future[T]
|
|
proc newInternalRaisesFutureImpl[T](): InternalRaisesFuture[T] =
|
|
let fut = InternalRaisesFuture[T]()
|
|
template newFuture[T](): auto =
|
|
newInternalRaisesFutureImpl[T]()
|
|
proc problematic(blockId: BID): Future[Option[seq[int]]] =
|
|
let resultFuture = newFuture[Option[seq[int]]]()
|
|
return resultFuture
|
|
let x = problematic("latest")
|