mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-03 11:42:33 +00:00
[cleanups] doassert => doAssert; mark deadcode (#14711)
This commit is contained in:
@@ -110,7 +110,7 @@ proc lookup(typeMap: LayeredIdTable, key: PType): PType =
|
||||
template put(typeMap: LayeredIdTable, key, value: PType) =
|
||||
idTablePut(typeMap.topLayer, key, value)
|
||||
|
||||
template checkMetaInvariants(cl: TReplTypeVars, t: PType) =
|
||||
template checkMetaInvariants(cl: TReplTypeVars, t: PType) = # noop code
|
||||
when false:
|
||||
if t != nil and tfHasMeta in t.flags and
|
||||
cl.allowMetaTypes == false:
|
||||
@@ -412,7 +412,7 @@ proc handleGenericInvocation(cl: var TReplTypeVars, t: PType): PType =
|
||||
newbody.attachedOps[attachedDeepCopy] = cl.c.instTypeBoundOp(cl.c, dc, result, cl.info,
|
||||
attachedDeepCopy, 1)
|
||||
if newbody.typeInst == nil:
|
||||
#doassert newbody.typeInst == nil
|
||||
# doAssert newbody.typeInst == nil
|
||||
newbody.typeInst = result
|
||||
if tfRefsAnonObj in newbody.flags and newbody.kind != tyGenericInst:
|
||||
# can come here for tyGenericInst too, see tests/metatype/ttypeor.nim
|
||||
@@ -670,14 +670,16 @@ proc replaceTypesInBody*(p: PContext, pt: TIdTable, n: PNode;
|
||||
result = replaceTypeVarsN(cl, n)
|
||||
popInfoContext(p.config)
|
||||
|
||||
proc replaceTypesForLambda*(p: PContext, pt: TIdTable, n: PNode;
|
||||
original, new: PSym): PNode =
|
||||
var typeMap = initLayeredTypeMap(pt)
|
||||
var cl = initTypeVars(p, typeMap, n.info, original)
|
||||
idTablePut(cl.symMap, original, new)
|
||||
pushInfoContext(p.config, n.info)
|
||||
result = replaceTypeVarsN(cl, n)
|
||||
popInfoContext(p.config)
|
||||
when false:
|
||||
# deadcode
|
||||
proc replaceTypesForLambda*(p: PContext, pt: TIdTable, n: PNode;
|
||||
original, new: PSym): PNode =
|
||||
var typeMap = initLayeredTypeMap(pt)
|
||||
var cl = initTypeVars(p, typeMap, n.info, original)
|
||||
idTablePut(cl.symMap, original, new)
|
||||
pushInfoContext(p.config, n.info)
|
||||
result = replaceTypeVarsN(cl, n)
|
||||
popInfoContext(p.config)
|
||||
|
||||
proc recomputeFieldPositions*(t: PType; obj: PNode; currPosition: var int) =
|
||||
if t != nil and t.len > 0 and t[0] != nil:
|
||||
|
||||
@@ -184,33 +184,33 @@ block tcasestm:
|
||||
doAssert(bstatic == false)
|
||||
|
||||
var bb: bool
|
||||
doassert(not compiles(
|
||||
doAssert(not compiles(
|
||||
bb = case str2:
|
||||
of "": raise newException(ValueError, "Invalid boolean")
|
||||
elif str.startsWith("Y"): true
|
||||
elif str.startsWith("N"): false
|
||||
))
|
||||
|
||||
doassert(not compiles(
|
||||
doAssert(not compiles(
|
||||
bb = case str2:
|
||||
of "Y": true
|
||||
of "N": false
|
||||
))
|
||||
|
||||
doassert(not compiles(
|
||||
doAssert(not compiles(
|
||||
bb = case str2:
|
||||
of "Y": true
|
||||
of "N": raise newException(ValueError, "N not allowed")
|
||||
))
|
||||
|
||||
doassert(not compiles(
|
||||
doAssert(not compiles(
|
||||
bb = case str2:
|
||||
of "Y": raise newException(ValueError, "Invalid Y")
|
||||
else: raise newException(ValueError, "Invalid N")
|
||||
))
|
||||
|
||||
|
||||
doassert(not compiles(
|
||||
doAssert(not compiles(
|
||||
bb = case str2:
|
||||
of "Y":
|
||||
raise newException(ValueError, "Invalid Y")
|
||||
@@ -219,7 +219,7 @@ block tcasestm:
|
||||
))
|
||||
|
||||
|
||||
doassert(not compiles(
|
||||
doAssert(not compiles(
|
||||
bb = case str2:
|
||||
of "Y":
|
||||
"invalid Y".quit(3)
|
||||
|
||||
@@ -110,21 +110,21 @@ block t6154:
|
||||
doAssert ps[0].attrsLen == 2
|
||||
doAssert ps[0].attr("class") == "foo"
|
||||
doAssert ps[0].attr("id") == "bar"
|
||||
doassert ps[0].len == 0
|
||||
doAssert ps[0].len == 0
|
||||
|
||||
doAssert ps[1].attrsLen == 1
|
||||
doAssert ps[1].attr("something") == "\tfoo\tbar²"
|
||||
doassert ps[1].len == 0
|
||||
doAssert ps[1].len == 0
|
||||
|
||||
doAssert ps[2].attrsLen == 2
|
||||
doAssert ps[2].attr("something") == "\tfoo\tbar²"
|
||||
doAssert ps[2].attr("foo") == "bloo"
|
||||
doassert ps[2].len == 0
|
||||
doAssert ps[2].len == 0
|
||||
|
||||
doAssert ps[3].attrsLen == 2
|
||||
doAssert ps[3].attr("class") == "foo2"
|
||||
doAssert ps[3].attr("id") == "bar2"
|
||||
doassert ps[3].len == 0
|
||||
doAssert ps[3].len == 0
|
||||
|
||||
doAssert ps[4].attrsLen == 1
|
||||
doAssert ps[4].attr("wrong") == ""
|
||||
@@ -133,12 +133,12 @@ block t6154:
|
||||
doAssert ps[5].attr("data-foo") == ""
|
||||
doAssert ps[5].attr("data-bar") == "correct!"
|
||||
doAssert ps[5].attr("enabled") == ""
|
||||
doassert ps[5].len == 0
|
||||
doAssert ps[5].len == 0
|
||||
|
||||
doAssert ps[6].attrsLen == 2
|
||||
doAssert ps[6].attr("quux") == ""
|
||||
doAssert ps[6].attr("whatever") == ""
|
||||
doassert ps[6].len == 0
|
||||
doAssert ps[6].len == 0
|
||||
|
||||
# bug #11713, #1034
|
||||
var content = """
|
||||
|
||||
@@ -65,8 +65,8 @@ doAssert fmt"{1.5: 08}" == " 00001.5" # works
|
||||
|
||||
# only add explicitly requested sign if value != -0.0 (neg zero)
|
||||
doAssert fmt"{-0.0:g}" == "-0"
|
||||
doassert fmt"{-0.0:+g}" == "-0"
|
||||
doassert fmt"{-0.0: g}" == "-0"
|
||||
doAssert fmt"{-0.0:+g}" == "-0"
|
||||
doAssert fmt"{-0.0: g}" == "-0"
|
||||
doAssert fmt"{0.0:g}" == "0"
|
||||
doAssert fmt"{0.0:+g}" == "+0"
|
||||
doAssert fmt"{0.0: g}" == " 0"
|
||||
|
||||
Reference in New Issue
Block a user