Clean out Deprecated proc (#14797)
* Remove and/or clean out Deprecated 'add' proc for floats * Update a test
This commit is contained in:
parent
d968163cd1
commit
5d5df4a394
3 changed files with 8 additions and 25 deletions
|
|
@ -66,10 +66,6 @@ proc addInt*(result: var string; x: int64) =
|
||||||
for j in 0..i div 2 - 1:
|
for j in 0..i div 2 - 1:
|
||||||
swap(result[base+j], result[base+i-j-1])
|
swap(result[base+j], result[base+i-j-1])
|
||||||
|
|
||||||
proc add*(result: var string; x: int64) {.deprecated:
|
|
||||||
"Deprecated since v0.20, use 'addInt'".} =
|
|
||||||
addInt(result, x)
|
|
||||||
|
|
||||||
proc nimIntToStr(x: int): string {.compilerRtl.} =
|
proc nimIntToStr(x: int): string {.compilerRtl.} =
|
||||||
result = newStringOfCap(sizeof(x)*4)
|
result = newStringOfCap(sizeof(x)*4)
|
||||||
result.addInt x
|
result.addInt x
|
||||||
|
|
@ -98,10 +94,6 @@ proc addFloat*(result: var string; x: float) =
|
||||||
let n = writeFloatToBuffer(buffer, x)
|
let n = writeFloatToBuffer(buffer, x)
|
||||||
result.addCstringN(cstring(buffer[0].addr), n)
|
result.addCstringN(cstring(buffer[0].addr), n)
|
||||||
|
|
||||||
proc add*(result: var string; x: float) {.deprecated:
|
|
||||||
"Deprecated since v0.20, use 'addFloat'".} =
|
|
||||||
addFloat(result, x)
|
|
||||||
|
|
||||||
proc nimFloatToStr(f: float): string {.compilerproc.} =
|
proc nimFloatToStr(f: float): string {.compilerproc.} =
|
||||||
result = newStringOfCap(8)
|
result = newStringOfCap(8)
|
||||||
result.addFloat f
|
result.addFloat f
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,13 @@
|
||||||
discard """
|
discard """
|
||||||
errormsg: "type mismatch: got <Bar[system.int]>"
|
errormsg: "type mismatch: got <Bar[system.int]>"
|
||||||
nimout: '''
|
nimout: '''
|
||||||
t3330.nim(78, 4) Error: type mismatch: got <Bar[system.int]>
|
t3330.nim(70, 4) Error: type mismatch: got <Bar[system.int]>
|
||||||
but expected one of:
|
but expected one of:
|
||||||
proc test(foo: Foo[int])
|
proc test(foo: Foo[int])
|
||||||
first type mismatch at position: 1
|
first type mismatch at position: 1
|
||||||
required type for foo: Foo[int]
|
required type for foo: Foo[int]
|
||||||
but expression 'bar' is of type: Bar[system.int]
|
but expression 'bar' is of type: Bar[system.int]
|
||||||
t3330.nim(63, 8) Hint: Non-matching candidates for add(k, string, T)
|
t3330.nim(55, 8) Hint: Non-matching candidates for add(k, string, T)
|
||||||
proc add(result: var string; x: float)
|
|
||||||
first type mismatch at position: 1
|
|
||||||
required type for result: var string
|
|
||||||
but expression 'k' is of type: Alias
|
|
||||||
proc add(result: var string; x: int64)
|
|
||||||
first type mismatch at position: 1
|
|
||||||
required type for result: var string
|
|
||||||
but expression 'k' is of type: Alias
|
|
||||||
proc add(x: var string; y: char)
|
proc add(x: var string; y: char)
|
||||||
first type mismatch at position: 1
|
first type mismatch at position: 1
|
||||||
required type for x: var string
|
required type for x: var string
|
||||||
|
|
@ -37,10 +29,10 @@ proc add[T](x: var seq[T]; y: sink T)
|
||||||
required type for x: var seq[T]
|
required type for x: var seq[T]
|
||||||
but expression 'k' is of type: Alias
|
but expression 'k' is of type: Alias
|
||||||
|
|
||||||
t3330.nim(63, 8) template/generic instantiation of `add` from here
|
t3330.nim(55, 8) template/generic instantiation of `add` from here
|
||||||
t3330.nim(70, 6) Foo: 'bar.value' cannot be assigned to
|
t3330.nim(62, 6) Foo: 'bar.value' cannot be assigned to
|
||||||
t3330.nim(63, 8) template/generic instantiation of `add` from here
|
t3330.nim(55, 8) template/generic instantiation of `add` from here
|
||||||
t3330.nim(71, 6) Foo: 'bar.x' cannot be assigned to
|
t3330.nim(63, 6) Foo: 'bar.x' cannot be assigned to
|
||||||
|
|
||||||
expression: test(bar)'''
|
expression: test(bar)'''
|
||||||
"""
|
"""
|
||||||
|
|
@ -76,4 +68,3 @@ proc test(foo: Foo[int]) =
|
||||||
|
|
||||||
var bar = Bar[int]()
|
var bar = Bar[int]()
|
||||||
bar.test()
|
bar.test()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -83,9 +83,9 @@ proc stringCompare() =
|
||||||
doAssert b == "bee"
|
doAssert b == "bee"
|
||||||
b.add g
|
b.add g
|
||||||
doAssert b == "bee"
|
doAssert b == "bee"
|
||||||
c.add 123.456
|
c.addFloat 123.456
|
||||||
doAssert c == "123.456"
|
doAssert c == "123.456"
|
||||||
d.add 123456
|
d.addInt 123456
|
||||||
doAssert d == "123456"
|
doAssert d == "123456"
|
||||||
|
|
||||||
doAssert e == ""
|
doAssert e == ""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue