From 20cf28adde8c6e3177f1cc0eca6fe249bc4de438 Mon Sep 17 00:00:00 2001 From: Araq Date: Wed, 30 Nov 2016 19:02:16 +0100 Subject: fixes the regressions introduced by fix for #5076 --- compiler/ccgexprs.nim | 8 ++++++-- compiler/extccomp.nim | 2 +- compiler/options.nim | 11 ++++++++++- compiler/pragmas.nim | 1 + 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/compiler/ccgexprs.nim b/compiler/ccgexprs.nim index 2761f888b..b863568d3 100644 --- a/compiler/ccgexprs.nim +++ b/compiler/ccgexprs.nim @@ -1129,7 +1129,11 @@ proc genNewSeqOfCap(p: BProc; e: PNode; d: var TLoc) = proc genConstExpr(p: BProc, n: PNode): Rope proc handleConstExpr(p: BProc, n: PNode, d: var TLoc): bool = - if d.k == locNone and n.len > ord(n.kind == nkObjConstr) and n.isDeepConstExpr: + proc forbiddenType(t: PType): bool {.inline.} = + result = t.kind == tyObject and not isObjLackingTypeField(t) + #echo "forbidden type ", result + if d.k == locNone and n.len > ord(n.kind == nkObjConstr) and n.isDeepConstExpr and + not forbiddenType(n.typ): var t = getUniqueType(n.typ) discard getTypeDesc(p.module, t) # so that any fields are initialized let id = nodeTableTestOrSet(p.module.dataCache, n, p.module.labels) @@ -1144,8 +1148,8 @@ proc handleConstExpr(p: BProc, n: PNode, d: var TLoc): bool = result = false proc genObjConstr(p: BProc, e: PNode, d: var TLoc) = - if handleConstExpr(p, e, d): return #echo rendertree e, " ", e.isDeepConstExpr + if handleConstExpr(p, e, d): return var tmp: TLoc var t = e.typ.skipTypes(abstractInst) getTemp(p, t, tmp) diff --git a/compiler/extccomp.nim b/compiler/extccomp.nim index 6f8b0b197..1f9af95a5 100644 --- a/compiler/extccomp.nim +++ b/compiler/extccomp.nim @@ -34,7 +34,7 @@ type TInfoCCProps* = set[TInfoCCProp] TInfoCC* = tuple[ name: string, # the short name of the compiler - objExt: string, # the compiler's object file extenstion + objExt: string, # the compiler's object file extension optSpeed: string, # the options for optimization for speed optSize: string, # the options for optimization for size compilerExe: string, # the compiler's executable diff --git a/compiler/options.nim b/compiler/options.nim index 04ed2412e..50f12d843 100644 --- a/compiler/options.nim +++ b/compiler/options.nim @@ -227,7 +227,16 @@ proc setDefaultLibpath*() = libpath = parentNimLibPath proc canonicalizePath*(path: string): string = - result = path.expandFilename + # on Windows, 'expandFilename' calls getFullPathName which doesn't do + # case corrections, so we have to use this convoluted way of retrieving + # the true filename (see tests/modules and Nimble uses 'import Uri' instead + # of 'import uri'): + when defined(windows): + result = path.expandFilename + for x in walkFiles(result): + return x + else: + result = path.expandFilename proc shortenDir*(dir: string): string = ## returns the interesting part of a dir diff --git a/compiler/pragmas.nim b/compiler/pragmas.nim index e11a8d08b..ffb2aa812 100644 --- a/compiler/pragmas.nim +++ b/compiler/pragmas.nim @@ -490,6 +490,7 @@ proc pragmaLine(c: PContext, n: PNode) = elif y.kind != nkIntLit: localError(n.info, errIntLiteralExpected) else: + # XXX this produces weird paths which are not properly resolved: n.info.fileIndex = msgs.fileInfoIdx(x.strVal) n.info.line = int16(y.intVal) else: -- cgit 1.4.1-2-gfad0