-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Description
I tried to use [0] for a type name and it leads to crash
Example
import typetraits, strutils
type
AbComponent* = object
template local*(expression: untyped): untyped {.dirty.} =
# this fails
# $(expression.type.name[0])
expression.type.name[0 .. 0]
var self = AbComponent()
echo local(2)Current Output
If you comment out, it crashes with
fatal.nim(39) sysFatal
Error: unhandled exception: index out of bounds, the container is empty [IndexError]
Expected Output
Running correctly and returning the first char
Possible Solution
- Don't know yet
Additional Information
- It works if i use
[0 .. 0]so this is a workaround
$ nim -v
Nim Compiler Version 1.1.1 [Linux: amd64]
Compiled at 2019-12-02
Copyright (c) 2006-2019 by Andreas Rumpf
git hash: 2acf74d458accf65d969199a389c8dbc2eedab55
active boot switches: -d:release
Metadata
Metadata
Assignees
Labels
No labels