Upgrade Nim compiler to 1.6.

The necessary changes are related to how `for` loops now implicitly
create a `lent` type, which is Nim's way of creating a "temporary"
reference to an item inside a collection - this helps performance by
avoiding a copy of the data, but it also means that the copy that
previously was implicit in the for loop must be made explicit in the
code.
This commit is contained in:
Jacek Sieka 2023-03-15 10:03:30 +01:00 committed by Jonathan Rainville
parent db6af0554a
commit e4f7269587
10 changed files with 16 additions and 4 deletions

1
.gitignore vendored
View File

@ -100,3 +100,4 @@ build/
*.exe
*.out
*.app
nimbus-build-system.paths

2
.gitmodules vendored
View File

@ -1,7 +1,7 @@
[submodule "vendor/nimbus-build-system"]
path = vendor/nimbus-build-system
url = https://github.com/status-im/nimbus-build-system.git
branch = status-desktop-1-2
branch = status-desktop
[submodule "vendor/nimqml"]
path = vendor/nimqml
url = https://github.com/status-im/nimqml.git

View File

@ -45,3 +45,6 @@ switch("warning", "ObservableStores:off")
# Too many false positives for "Warning: method has lock level <unknown>, but another method has 0 [LockLevel]"
switch("warning", "LockLevel:off")
# No clean workaround for this warning in certain cases, waiting for better upstream support
switch("warning", "BareExcept:off")

View File

@ -7,7 +7,7 @@ import
./custom_urls/urls_manager
export eventemitter
export signals_manager, fleet_configuration
export threadpool, signals_manager, fleet_configuration
type StatusFoundation* = ref object
events*: EventEmitter

View File

@ -7,7 +7,7 @@ import # vendor libs
import # status-desktop libs
./common
export common, json_serialization
export common, json_serialization, taskpools
logScope:
topics = "task-threadpool"

View File

@ -123,6 +123,7 @@ QtObject:
var generatedAccounts: seq[GeneratedWalletItem] = @[]
for item in items:
let item = item # TODO https://github.com/nim-lang/Nim/issues/16740
# Default Account
if item.getWalletType() == "":
statusDefaultAccountDerivedFrom = item.getDerivedFrom()

View File

@ -12,6 +12,7 @@ proc replacePubKeysWithDisplayNames*(allKnownContacts: seq[ContactsDto], message
updatedMessage = updatedMessage.replaceWord(pair[1], pair[0])
for pk in pubKeys:
let pk = pk # TODO https://github.com/nim-lang/Nim/issues/16740
let listOfMatched = allKnownContacts.filter(x => "@" & x.id == pk)
if(listOfMatched.len > 0):
updatedMessage = updatedMessage.replaceWord(pk, "@" & listOfMatched[0].userDefaultDisplayName())
@ -35,16 +36,19 @@ proc replaceMentionsWithPubKeys*(allKnownContacts: seq[ContactsDto], message: st
# In the following lines we're free to compare to `x.userDefaultDisplayName()` cause that's actually what we're displaying
# in the mentions suggestion list.
for mention in aliasMentions:
let mention = mention # TODO https://github.com/nim-lang/Nim/issues/16740
let listOfMatched = allKnownContacts.filter(x => "@" & x.userDefaultDisplayName().toLowerAscii == mention.toLowerAscii)
if(listOfMatched.len > 0):
updatedMessage = updatedMessage.replaceWord(mention, '@' & listOfMatched[0].id)
for mention in ensMentions:
let mention = mention # TODO https://github.com/nim-lang/Nim/issues/16740
let listOfMatched = allKnownContacts.filter(x => "@" & x.name.toLowerAscii == mention.toLowerAscii)
if(listOfMatched.len > 0):
updatedMessage = updatedMessage.replaceWord(mention, '@' & listOfMatched[0].id)
for mention in nameMentions:
let mention = mention # TODO https://github.com/nim-lang/Nim/issues/16740
let listOfMatched = allKnownContacts.filter(x => x.userDefaultDisplayName().toLowerAscii == mention.toLowerAscii or
"@" & x.userDefaultDisplayName().toLowerAscii == mention.toLowerAscii)
if(listOfMatched.len > 0):

View File

@ -86,6 +86,7 @@ QtObject:
let networks = self.networkService.getNetworks()
for network in networks:
let network = network # TODO https://github.com/nim-lang/Nim/issues/16740
var found = false
for chainId in self.tokens.keys:
if chainId == network.chainId:

View File

@ -266,6 +266,7 @@ QtObject:
try:
let accounts = self.fetchAccounts()
for account in accounts:
let account = account # TODO https://github.com/nim-lang/Nim/issues/16740
self.setEnsName(account)
self.setRelatedAccountsToAccount(account)
self.storeAccount(account)
@ -335,6 +336,7 @@ QtObject:
var newAccount: WalletAccountDto
var found = false
for account in accounts:
let account = account # TODO https://github.com/nim-lang/Nim/issues/16740
if not self.walletAccountsContainsAddress(account.address):
found = true
newAccount = account

@ -1 +1 @@
Subproject commit 5eca896a36b440aad565d2845122964742a0540b
Subproject commit 3b25a48da3e4f00ca601d9254711762f4bf1cc98