From f827d7580488fd47dfdb505b18a70215f62726b3 Mon Sep 17 00:00:00 2001 From: alaviss Date: Thu, 24 Oct 2019 16:21:37 +0000 Subject: [PATCH] compiler/semcall: return the correct lineinfo for nkCallStrLit (#12484) --- compiler/semcall.nim | 3 ++- nimsuggest/tests/tcallstrlit_highlight.nim | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 nimsuggest/tests/tcallstrlit_highlight.nim diff --git a/compiler/semcall.nim b/compiler/semcall.nim index f9f547c47..be9d9ebde 100644 --- a/compiler/semcall.nim +++ b/compiler/semcall.nim @@ -474,7 +474,8 @@ proc updateDefaultParams(call: PNode) = proc getCallLineInfo(n: PNode): TLineInfo = case n.kind - of nkAccQuoted, nkBracketExpr, nkCall, nkCommand: getCallLineInfo(n.sons[0]) + of nkAccQuoted, nkBracketExpr, nkCall, nkCallStrLit, nkCommand: + getCallLineInfo(n.sons[0]) of nkDotExpr: getCallLineInfo(n.sons[1]) else: n.info diff --git a/nimsuggest/tests/tcallstrlit_highlight.nim b/nimsuggest/tests/tcallstrlit_highlight.nim new file mode 100644 index 000000000..6f5b0f792 --- /dev/null +++ b/nimsuggest/tests/tcallstrlit_highlight.nim @@ -0,0 +1,11 @@ +func foo(s: string) = discard + +foo"string"#[!]# + +discard """ +$nimsuggest --tester $file +>highlight $1 +highlight;;skFunc;;1;;5;;3 +highlight;;skType;;1;;12;;6 +highlight;;skFunc;;3;;0;;3 +"""