fixes #1774
This commit is contained in:
parent
a93585e47f
commit
2ee2401336
5 changed files with 10 additions and 7 deletions
|
|
@ -1,7 +1,5 @@
|
||||||
# Special configuration file for the Nim project
|
# Special configuration file for the Nim project
|
||||||
|
|
||||||
# gc:markAndSweep
|
|
||||||
|
|
||||||
hint[XDeclaredButNotUsed]:off
|
hint[XDeclaredButNotUsed]:off
|
||||||
path:"llvm"
|
path:"llvm"
|
||||||
path:"$projectPath/.."
|
path:"$projectPath/.."
|
||||||
|
|
|
||||||
|
|
@ -985,7 +985,7 @@ proc builtinFieldAccess(c: PContext, n: PNode, flags: TExprFlags): PNode =
|
||||||
of tyTypeParamsHolders:
|
of tyTypeParamsHolders:
|
||||||
return readTypeParameter(c, ty, i, n.info)
|
return readTypeParameter(c, ty, i, n.info)
|
||||||
of tyObject, tyTuple:
|
of tyObject, tyTuple:
|
||||||
if ty.n.kind == nkRecList:
|
if ty.n != nil and ty.n.kind == nkRecList:
|
||||||
for field in ty.n:
|
for field in ty.n:
|
||||||
if field.sym.name == i:
|
if field.sym.name == i:
|
||||||
n.typ = newTypeWithSons(c, tyFieldAccessor, @[ty, field.sym.typ])
|
n.typ = newTypeWithSons(c, tyFieldAccessor, @[ty, field.sym.typ])
|
||||||
|
|
|
||||||
|
|
@ -653,7 +653,8 @@ proc checkForMetaFields(n: PNode) =
|
||||||
template checkMeta(t) =
|
template checkMeta(t) =
|
||||||
if t != nil and t.isMetaType and tfGenericTypeParam notin t.flags:
|
if t != nil and t.isMetaType and tfGenericTypeParam notin t.flags:
|
||||||
localError(n.info, errTIsNotAConcreteType, t.typeToString)
|
localError(n.info, errTIsNotAConcreteType, t.typeToString)
|
||||||
|
|
||||||
|
if n.isNil: return
|
||||||
case n.kind
|
case n.kind
|
||||||
of nkRecList, nkRecCase:
|
of nkRecList, nkRecCase:
|
||||||
for s in n: checkForMetaFields(s)
|
for s in n: checkForMetaFields(s)
|
||||||
|
|
|
||||||
|
|
@ -74,9 +74,6 @@ proc suggestField(c: PContext, s: PSym, outputs: var int) =
|
||||||
suggestWriteln(symToStr(s, isLocal=true, sectionSuggest))
|
suggestWriteln(symToStr(s, isLocal=true, sectionSuggest))
|
||||||
inc outputs
|
inc outputs
|
||||||
|
|
||||||
when not defined(nimhygiene):
|
|
||||||
{.pragma: inject.}
|
|
||||||
|
|
||||||
template wholeSymTab(cond, section: expr) {.immediate.} =
|
template wholeSymTab(cond, section: expr) {.immediate.} =
|
||||||
var isLocal = true
|
var isLocal = true
|
||||||
for scope in walkScopes(c.currentScope):
|
for scope in walkScopes(c.currentScope):
|
||||||
|
|
|
||||||
7
tests/typerel/typedescs.nim
Normal file
7
tests/typerel/typedescs.nim
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
# bug #1774
|
||||||
|
proc p(T: typedesc) = discard
|
||||||
|
|
||||||
|
p(type((5, 6))) # Compiles
|
||||||
|
(type((5, 6))).p # Doesn't compile (SIGSEGV: Illegal storage access.)
|
||||||
|
type T = type((5, 6)) # Doesn't compile (SIGSEGV: Illegal storage access.)
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue