summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorBung <crc32@qq.com>2022-10-13 12:39:43 +0800
committerGitHub <noreply@github.com>2022-10-13 06:39:43 +0200
commit169d3fda0020ec5c904f70f9026a2d3bd59f9599 (patch)
treea47171425541d2684867e6ee4835fe1940f1864d
parenta1a9d63d22ec072bbfc1555610c5fd8b881f083d (diff)
downloadNim-169d3fda0020ec5c904f70f9026a2d3bd59f9599.tar.gz
fix #18136 tests/proc/t17157.nim now gives SIGSEGV instead of error (#20555)
-rw-r--r--compiler/semtypes.nim1
-rw-r--r--tests/proc/t17157.nim1
2 files changed, 1 insertions, 1 deletions
diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim
index 8b1abdd01..e254965c9 100644
--- a/compiler/semtypes.nim
+++ b/compiler/semtypes.nim
@@ -1257,6 +1257,7 @@ proc newProcType(c: PContext; info: TLineInfo; prev: PType = nil): PType =
   result.n.add newNodeI(nkEffectList, info)
 
 proc isMagic(sym: PSym): bool =
+  if sym.ast == nil: return false
   let nPragmas = sym.ast[pragmasPos]
   return hasPragma(nPragmas, wMagic)
 
diff --git a/tests/proc/t17157.nim b/tests/proc/t17157.nim
index 2927eeee8..020e93fce 100644
--- a/tests/proc/t17157.nim
+++ b/tests/proc/t17157.nim
@@ -1,6 +1,5 @@
 discard """
   errormsg: "'untyped' is only allowed in templates and macros or magic procs"
-  disabled: true
 """
 
 template something(op: proc (v: untyped): void): void =
n160' href='#n160'>160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262