mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
@@ -1140,7 +1140,7 @@ proc typeRel(c: var TCandidate, f, aOrig: PType,
|
||||
let x = typeRel(c, a, f, flags + {trDontBind})
|
||||
if x >= isGeneric:
|
||||
return isGeneric
|
||||
|
||||
|
||||
of tyFromExpr:
|
||||
if c.c.inGenericContext > 0:
|
||||
# generic type bodies can sometimes compile call expressions
|
||||
@@ -1950,7 +1950,12 @@ proc implicitConv(kind: TNodeKind, f: PType, arg: PNode, m: TCandidate,
|
||||
|
||||
if result.typ == nil: internalError(c.graph.config, arg.info, "implicitConv")
|
||||
result.add c.graph.emptyNode
|
||||
result.add arg
|
||||
if arg.typ != nil and arg.typ.kind == tyLent:
|
||||
let a = newNodeIT(nkHiddenDeref, arg.info, arg.typ[0])
|
||||
a.add arg
|
||||
result.add a
|
||||
else:
|
||||
result.add arg
|
||||
|
||||
proc isLValue(c: PContext; n: PNode, isOutParam = false): bool {.inline.} =
|
||||
let aa = isAssignable(nil, n)
|
||||
|
||||
@@ -30,3 +30,23 @@ let x2 = x.byLentVar
|
||||
|
||||
let xs2 = xs.byLentVar
|
||||
echo xs2
|
||||
|
||||
# bug #22138
|
||||
|
||||
type Xxx = object
|
||||
|
||||
type
|
||||
Opt[T] = object
|
||||
case oResultPrivate*: bool
|
||||
of false:
|
||||
discard
|
||||
of true:
|
||||
vResultPrivate*: T
|
||||
|
||||
func value*[T: not void](self: Opt[T]): lent T {.inline.} =
|
||||
self.vResultPrivate
|
||||
template get*[T: not void](self: Opt[T]): T = self.value()
|
||||
|
||||
method connect*(
|
||||
self: Opt[(int, int)]) =
|
||||
discard self.get()[0]
|
||||
|
||||
Reference in New Issue
Block a user