Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Makes it compile with nim 2.1.99 #fixes #36 #37

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

jmgomez
Copy link

@jmgomez jmgomez commented Sep 21, 2024

No description provided.

@samsamros samsamros self-requested a review October 2, 2024 15:17
@mashingan
Copy link
Owner

Tried running this with nimble test got this message:

~/anonimongo/tests/utils_test.nim(78, 34) template/generic instantiation of `newMongo` from here
~/anonimongo/src/anonimongo/core/types.nim(306, 17) Error: ambiguous identifier: 'Uri' -- use one of the following:
  uri.Uri: Uri
  QKind.URI: QKind

I think it's because the uri variable defined above it make it ambiguous to use it as uri.Uri.

@jmgomez
Copy link
Author

jmgomez commented Oct 3, 2024

Tried running this with nimble test got this message:

~/anonimongo/tests/utils_test.nim(78, 34) template/generic instantiation of `newMongo` from here
~/anonimongo/src/anonimongo/core/types.nim(306, 17) Error: ambiguous identifier: 'Uri' -- use one of the following:
  uri.Uri: Uri
  QKind.URI: QKind

I think it's because the uri variable defined above it make it ambiguous to use it as uri.Uri.

Yes. Thats why I moved it to the top in one of the changes. I missed that one because I couldnt get the test to work in local and it seems that the error you are seeing didnt trigger by my use case

@mashingan
Copy link
Owner

It's solved by adjusting to uri.Uri so it won't be ambiguous anymore.

Also, at very least you should run nim r tests/test_bson_test.nim to check if it's breaking or not due to version upgrade.
This won't boot up mongod child process and simply tests for BSON module.

In case you want to test for most of db commands, you can set your config.nims like in this github action setting.
As long the standalone test is completed, whether success or failed, it will kill the booted mongod child process.

@samsamros
Copy link
Collaborator

I will test soon, what is the status, was the Uri.uri adjusted? did it work?

@mashingan
Copy link
Owner

No, not yet.
The regressions are more than that.

@samsamros
Copy link
Collaborator

samsamros commented Dec 15, 2024

I'm testing these changes... they seem to work fine on some of my applications. I'm still debugging other issues and going really slow, but these changes appear to work fine so far. Has anyone else done any testing for this branch?

Update when running testing:

/home/testing/shared/anonimongo/tests/test_bson_test.nim(24, 27) Error: type mismatch
Expression: newbson([("hello", toBson(100)), ("array world", bsonArray(["red", 50, 4.2])),
         ("hello world", toBson(isekai))])
  [1] [("hello", toBson(100)), ("array world", bsonArray(["red", 50, 4.2])),
 ("hello world", toBson(isekai))]: array[0..2, (string, BsonBase)]

Expected one of (first mismatch at [position]):
[1] proc newBson(first: (string, BsonBase); table: varargs[(string, BsonBase)]): BsonDocument
[1] proc newBson(table = newOrderedTable[string, BsonBase]();
             stream: Streamable = newStream(); filename = ""): BsonDocument

       Tip: 55 messages have been suppressed, use --verbose to show them.
tools.nim(36)            doCmd

    Error:  Execution failed with exit code 1

which I managed to change by explicitly adding table = newOrderedTable([...])

there are other issues I'm still testing, specifically regarding the Time type.

@samsamros
Copy link
Collaborator

I'm testing these changes... they seem to work fine on some of my applications. I'm still debugging other issues and going really slow, but these changes appear to work fine so far. Has anyone else done any testing for this branch?

Update when running testing:

/home/testing/shared/anonimongo/tests/test_bson_test.nim(24, 27) Error: type mismatch
Expression: newbson([("hello", toBson(100)), ("array world", bsonArray(["red", 50, 4.2])),
         ("hello world", toBson(isekai))])
  [1] [("hello", toBson(100)), ("array world", bsonArray(["red", 50, 4.2])),
 ("hello world", toBson(isekai))]: array[0..2, (string, BsonBase)]

Expected one of (first mismatch at [position]):
[1] proc newBson(first: (string, BsonBase); table: varargs[(string, BsonBase)]): BsonDocument
[1] proc newBson(table = newOrderedTable[string, BsonBase]();
             stream: Streamable = newStream(); filename = ""): BsonDocument

       Tip: 55 messages have been suppressed, use --verbose to show them.
tools.nim(36)            doCmd

    Error:  Execution failed with exit code 1

which I managed to change by explicitly adding table = newOrderedTable([...])

there are other issues I'm still testing, specifically regarding the Time type.

Update:

I've been trying to run the tests. there are multiple errors in the test_bson_test.nim.
However, I've also been conducting tests on some of my applications as I slowly debug the multiple broken code from updating to 2.2.0. With this PR it seems to work fine.

Times and Ints seem to be the major issue... we may need to go through all of these issues to test the macros.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants