mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 14:00:35 +00:00
fixes #23949 It can also allow `endsInNoReturn` in branches later
This commit is contained in:
25
tests/lent/tlents.nim
Normal file
25
tests/lent/tlents.nim
Normal file
@@ -0,0 +1,25 @@
|
||||
discard """
|
||||
targets: "c cpp"
|
||||
"""
|
||||
|
||||
type A = object
|
||||
field: int
|
||||
|
||||
proc x(a: A): lent int =
|
||||
result = case true
|
||||
of true:
|
||||
a.field
|
||||
of false:
|
||||
a.field
|
||||
|
||||
proc y(a: A): lent int =
|
||||
result = if true:
|
||||
a.field
|
||||
else:
|
||||
a.field
|
||||
|
||||
block:
|
||||
var a = A(field: 1)
|
||||
doAssert x(a) == 1
|
||||
doAssert y(a) == 1
|
||||
|
||||
Reference in New Issue
Block a user