summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2021-02-18 12:15:21 +0100
committerGitHub <noreply@github.com>2021-02-18 12:15:21 +0100
commit8fd1ed6dfe68c98bee7f69d26946df8003f930c5 (patch)
tree5042d39300f910ac113dd36ca34c6be82a0f4743 /compiler
parentf400b5c26b463b6636f3f62c4a32bf372a05db58 (diff)
downloadNim-8fd1ed6dfe68c98bee7f69d26946df8003f930c5.tar.gz
fixes #17060 (#17083)
Diffstat (limited to 'compiler')
-rw-r--r--compiler/linter.nim4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/linter.nim b/compiler/linter.nim
index 77e0a84e4..1ae1fb097 100644
--- a/compiler/linter.nim
+++ b/compiler/linter.nim
@@ -55,7 +55,9 @@ proc beautifyName(s: string, k: TSymKind): string =
   inc i
   while i < s.len:
     if s[i] == '_':
-      if i > 0 and s[i-1] in {'A'..'Z'}:
+      if i+1 >= s.len:
+        discard "trailing underscores should be stripped off"
+      elif i > 0 and s[i-1] in {'A'..'Z'}:
         # don't skip '_' as it's essential for e.g. 'GC_disable'
         result.add('_')
         inc i