-
Notifications
You must be signed in to change notification settings - Fork 16
Semantic objects #157
Semantic objects #157
Conversation
.gitignore
Outdated
| .cache/* | ||
| __pycache__ | ||
| makebuild.sh | ||
| .vscode/launch.json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.vscode/?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in the next commit.
driver/fixtures/fixtures_test.go
Outdated
| }, | ||
| BenchName: "issue_server101", | ||
| // XXX check this | ||
| //Semantic: fixtures.SemanticConfig{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Time to uncomment this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in the next push.
driver/normalizer/normalizer.go
Outdated
| var Preprocessors = []Mapping{ | ||
| ObjectToNode{ | ||
| InternalTypeKey: "ast_type", | ||
| // FIXME: if the node doesn't have positions or is missing end positions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be fixed now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in the next push.
driver/normalizer/normalizer.go
Outdated
| return n, nil | ||
| } | ||
|
|
||
| // FIXME: decorators? (annotations/tags) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now, this can be solved by adding a separate property to the node with async.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mmmm, I don't understand well you here.
driver/normalizer/normalizer.go
Outdated
|
|
||
| // FIXME: decorators? (annotations/tags) | ||
| // FIXME: in Python, an argument being variadic or not depends on being on | ||
| // args.[kwonlyargs|args] or plain "args" not on any property of the argument |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understood this correctly, it can be solved by using Cases operator. Please check Java/JS/Go for an example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was pretty complicated. Forgot to remove that comment; I did the easiest option and changed the native structure to use the standard Arg(with properties)->Default argument instead of the multiple lists to you should have to match aligning to the right...
| } | ||
| } | ||
| } | ||
| 'PY3AST': { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please regenerate the fixtures as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Odd. I deleted the fixtures, updated the SDK, did bblfsh-sdk update on the driver dir and regenerated the fixtures with go test and is still using that format.
fixtures/annotations.py.sem.uast
Outdated
| async: false, | ||
| }, | ||
| { '@type': "uast:Alias", | ||
| Name: "somefunc", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be an Identifier node
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
fixtures/annotations.py.sem.uast
Outdated
| }, | ||
| ], | ||
| Type: { '@type': "uast:FunctionType", | ||
| Arguments: { '@type': "arguments", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Arguments should be an array
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
| }, | ||
| Init: ~, | ||
| MapVariadic: false, | ||
| Name: "a", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be an Identifier node
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
|
Did some fixes, still not finished here but at least now all the semantic objects are being generated 🎉 , which allows me to find some problems (other than the indicated here of |
|
Outside of the problem of nodes with missing partial or total positional info not being processed, I think I've fixed all the issues, but that problem doesn't allow me to check if |
|
@dennwc as requested, updated so Unfortunately, this breaks |
|
@juanjux It's expected that user will run |
|
To make the directory self contained you've to investigate how to do it, how to install modules to a specific path, add the libs in that path to the language path, how to do the same with the binary. This for every language, while installing everything "globally" into a container fixes everything and avoid exotic running environment that could cause side effects (and I've found several of these as you know with this approach). |
driver/fixtures/fixtures_test.go
Outdated
| } | ||
|
|
||
| func SetPythonPath() { | ||
| os.Setenv("PYTHONPATH", filepath.Join(projectRoot, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can make ./build/bin/native a bash script, set an env variable there and call python_driver from it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it actually is already a bash script, I'll change it, I was just testing things to make this work, but I fear the environment variable solution won't work for parsing when the Python2 binary must be called, maybe with .pth files...
|
@dennwc with the SDK's update and the comments fix all nodes are now processed (searching for "ast_type" in I still need to fix |
|
@dennwc I kept the setting of the PYTHONPATH environment variable on the I've also tested that it doesn't have problems on the tests that force the Python2 interpreter (like PS: also rebased. |
driver/fixtures/fixtures_test.go
Outdated
| "LineComment", | ||
| "Block", | ||
| "ImportDeclaration", | ||
| "MethodDeclaration", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't find this type in the Python's native AST. Is it a list for Java?
fixtures/u2_func_simple.py.sem.uast
Outdated
| '@pos': { '@type': "uast:Positions", | ||
| }, | ||
| body: [ | ||
| { '@type': "FunctionDef", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uast:FunctionGroup
fixtures/u2_func_simple.py.sem.uast
Outdated
| }, | ||
| body: [ | ||
| { '@type': "FunctionDef", | ||
| '@token': "testfnc1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uast:Identifier
fixtures/u2_func_simple.py.sem.uast
Outdated
| }, | ||
| ], | ||
| }, | ||
| body: { '@type': "FunctionDef.body", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uast:Block
| Name: "a", | ||
| }, | ||
| ], | ||
| value: { '@type': "Call", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could convert an __import__() to RuntimeImport as well. Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unsure. There are actually tons of different ways to side-import things in python:
- Read and eval and assign to a global name in the module table.
- imp module.
- importlib
- ...many others that I don't remember but I've seen in the past, some of those pretty exotic.
But is true that __import__ is a default function in Python so that case at least could be easy to handle.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After some consideration, I've decided that I'll not convert __import__ in this version:
-
The argument could be a string, but also could be a variable, a function call, etc so we don't have a real way to know the
RuntimeImport.path. -
It will be assigned to a returned value that could be different from the argument.
This would need pretty complex annotations or flow analysis in the native drivers and thus I think is better to leave it to future versions to don't delay this anymore.
fixtures/u2_import_path.py.sem.uast
Outdated
| }, | ||
| All: false, | ||
| Names: [ | ||
| { '@type': "alias", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uast:Identifier or uast:Alias
fixtures/u2_import_path.py.sem.uast
Outdated
| }, | ||
| }, | ||
| ], | ||
| Path: "c", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uast:String
driver/fixtures/fixtures_test.go
Outdated
| NewDriver: func() driver.BaseDriver { | ||
| return driver.NewExecDriverAt(filepath.Join(projectRoot, "build/bin/native")) | ||
| return driver.NewExecDriverAt(filepath.Join(projectRoot, | ||
| "build/.local/bin/python_driver")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally, we shouldn't change the path to native driver (../../build/bin/native). That script should use relative paths so it doesn't matter if it's in /opt/bblfsh/driver or in the project directory.
|
All checks from |
|
@juanjux Please update fixture files |
|
@dennwc they are updated :-? |
|
Here's the output I'm getting: Details``` ~/go/src/github.com/bblfsh/python-driver$ git pull Already up to date. ~/go/src/github.com/bblfsh/python-driver$ go test ./driver/fixtures/ --- FAIL: TestPythonDriver (8.92s) --- FAIL: TestPythonDriver/native (0.85s) --- FAIL: TestPythonDriver/native/funcdef_kwonlyargs (0.00s) fixtures.go:154: Error Trace: fixtures.go:154 Error: Not equal: expected: "{\n 'PY3AST': {\n 'ast_type': \"Module\",\n... Test: TestPythonDriver/native/funcdef_kwonlyargs --- FAIL: TestPythonDriver/native/issue_server101 (0.47s) fixtures.go:154: Error Trace: fixtures.go:154 Error: Not equal: Test: TestPythonDriver/native/issue_server101 --- FAIL: TestPythonDriver/native/u2_func_params_kwonlyargs (0.00s) fixtures.go:154: Error Trace: fixtures.go:154 Error: Not equal: expected: "{\n 'PY3AST': {\n 'ast_type': \"Module\",\n... Test: TestPythonDriver/native/u2_func_params_kwonlyargs --- FAIL: TestPythonDriver/native/u2_func_params_kwonlyargs_default (0.00s) fixtures.go:154: Error Trace: fixtures.go:154 Error: Not equal: expected: "{\n 'PY3AST': {\n 'ast_type': \"Module\",\n body: [\n... Test: TestPythonDriver/native/u2_func_params_kwonlyargs_default --- FAIL: TestPythonDriver/native/u2_func_params_variadic_list (0.00s) fixtures.go:154: Error Trace: fixtures.go:154 Error: Not equal: expected: "{\n 'PY3AST': {\n 'ast_type': \"Module\",\n body: [\n {\n... Test: TestPythonDriver/native/u2_func_params_variadic_list --- FAIL: TestPythonDriver/native/u2_func_params_variadic_map (0.00s) fixtures.go:154: Error Trace: fixtures.go:154 Error: Not equal: expected: "{\n 'PY3AST': {\n 'ast_type': \"Module\",\n body: [\n {\n... Test: TestPythonDriver/native/u2_func_params_variadic_map --- FAIL: TestPythonDriver/uast (3.69s) --- FAIL: TestPythonDriver/uast/funcdef_kwonlyargs (0.01s) fixtures.go:254: Error Trace: fixtures.go:254 Error: Not equal: expected: "{ '@type': \"Module\",\n '@ROLE': [File, Module],\n '@pos': { ... Test: TestPythonDriver/uast/funcdef_kwonlyargs --- FAIL: TestPythonDriver/uast/issue_server101 (2.53s) fixtures.go:254: Error Trace: fixtures.go:254 Error: Not equal: Test: TestPythonDriver/uast/issue_server101 --- FAIL: TestPythonDriver/uast/u2_func_params_kwonlyargs (0.01s) fixtures.go:254: Error Trace: fixtures.go:254 Error: Not equal: expected: "{ '@type': \"Module\",\n '@ROLE': [File, Module],\n '@pos': { ... Test: TestPythonDriver/uast/u2_func_params_kwonlyargs --- FAIL: TestPythonDriver/uast/u2_func_params_kwonlyargs_default (0.01s) fixtures.go:254: Error Trace: fixtures.go:254 Error: Not equal: expected: "{ '@type': \"Module\",\n '@ROLE': [File, Module],\n '@pos': { ... Test: TestPythonDriver/uast/u2_func_params_kwonlyargs_default --- FAIL: TestPythonDriver/uast/u2_func_params_variadic_list (0.00s) fixtures.go:254: Error Trace: fixtures.go:254 Error: Not equal: expected: "{ '@type': \"Module\",\n '@ROLE': [File, Module],\n '@pos': { ... Test: TestPythonDriver/uast/u2_func_params_variadic_list --- FAIL: TestPythonDriver/uast/u2_func_params_variadic_map (0.00s) fixtures.go:254: Error Trace: fixtures.go:254 Error: Not equal: expected: "{ '@type': \"Module\",\n '@ROLE': [File, Module],\n '@pos': { ... Test: TestPythonDriver/uast/u2_func_params_variadic_map --- FAIL: TestPythonDriver/semantic (4.38s) --- FAIL: TestPythonDriver/semantic/issue30 (0.01s) fixtures.go:213: blacklisted nodes of type "Import" (1) found in the tree --- FAIL: TestPythonDriver/semantic/issue62 (0.01s) fixtures.go:213: blacklisted nodes of type "Import" (2) found in the tree --- FAIL: TestPythonDriver/semantic/issue94 (0.07s) fixtures.go:213: blacklisted nodes of type "Import" (3) found in the tree --- FAIL: TestPythonDriver/semantic/issue96 (0.07s) fixtures.go:213: blacklisted nodes of type "Import" (3) found in the tree --- FAIL: TestPythonDriver/semantic/issue_server101 (2.96s) fixtures.go:213: blacklisted nodes of type "Import" (6) found in the tree fixtures.go:230: type check failed for "uast:Function": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:FunctionType": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:Function": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:FunctionType": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:Function": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:FunctionType": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:Function": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:FunctionType": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:Function": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:FunctionType": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:Function": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:FunctionType": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:Function": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:FunctionType": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:Function": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:FunctionType": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:Function": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:FunctionType": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:Function": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:FunctionType": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:Function": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:FunctionType": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:Function": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:FunctionType": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:Function": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:FunctionType": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:Function": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:FunctionType": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:Function": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:FunctionType": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:Function": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:FunctionType": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:Function": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:FunctionType": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:Function": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:FunctionType": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:Function": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:FunctionType": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:Function": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:FunctionType": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:Function": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:FunctionType": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:Function": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:FunctionType": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:Function": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:FunctionType": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:Function": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:FunctionType": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:Function": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:FunctionType": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:Function": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:FunctionType": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:Function": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:FunctionType": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:Function": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:FunctionType": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:Function": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:FunctionType": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:Function": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:FunctionType": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:Function": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:FunctionType": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:Function": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:FunctionType": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:Function": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:FunctionType": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:Function": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:FunctionType": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:Function": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:FunctionType": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:Function": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:FunctionType": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:Function": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:FunctionType": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:Function": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:FunctionType": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:Function": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:FunctionType": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:Function": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:FunctionType": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:Function": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:FunctionType": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:Function": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:230: type check failed for "uast:FunctionType": incorrect object type: "uast:Identifier", expected: "uast:Argument" fixtures.go:254: Error Trace: fixtures.go:254 Error: Not equal: Test: TestPythonDriver/semantic/issue_server101 --- FAIL: TestPythonDriver/semantic/u2_func_params_variadic_list (0.01s) fixtures.go:254: Error Trace: fixtures.go:254 Error: Not equal: expected: "{ '@type': \"Module\",\n '@ROLE': [File, Module],\n '@pos': { ... Test: TestPythonDriver/semantic/u2_func_params_variadic_list --- FAIL: TestPythonDriver/semantic/u2_func_params_variadic_map (0.01s) fixtures.go:254: Error Trace: fixtures.go:254 Error: Not equal: expected: "{ '@type': \"Module\",\n '@ROLE': [File, Module],\n '@pos': { ... Test: TestPythonDriver/semantic/u2_func_params_variadic_map --- FAIL: TestPythonDriver/semantic/u2_import_module_alias (0.00s) fixtures.go:213: blacklisted nodes of type "Import" (1) found in the tree --- FAIL: TestPythonDriver/semantic/u2_import_multiple (0.01s) fixtures.go:213: blacklisted nodes of type "Import" (1) found in the tree --- FAIL: TestPythonDriver/semantic/u2_import_rename (0.01s) fixtures.go:213: blacklisted nodes of type "Import" (1) found in the tree --- FAIL: TestPythonDriver/semantic/u2_import_simple (0.01s) fixtures.go:213: blacklisted nodes of type "Import" (2) found in the tree --- FAIL: TestPythonDriver/semantic/u2_import_subsymbol (0.01s) fixtures.go:213: blacklisted nodes of type "Import" (1) found in the tree --- FAIL: TestPythonDriver/semantic/u2_import_subsymbol_alias (0.01s) fixtures.go:213: blacklisted nodes of type "Import" (1) found in the tree FAIL FAIL github.com/bblfsh/python-driver/driver/fixtures 8.925s ``` |
|
@dennwc added a missing file, could you try again? |
|
@dennwc good catch, should be fixed now. |
|
PR updated with some more positions added to some I was thinking of creating (in Go, I fear) a generic tokenizer pass that could, given a token string and a range of positions, get the token position by the name and the range. For example for a function argument called |
- Added mappings for comments, imports and functions - Change uast.Import for RuntimeImport - Fix for comments and function arguments Signed-off-by: Juanjo Alvarez <juanjo@sourced.tech>
…rovements - Normalized function arguments, updated annotations to the new format - Removed positions since they don't work when endpos is missing. Added new argument annotations - Remove two now unneeded workarounds (fix in Python ast module and fix in the SDK) - Use uast:Identifiers instead of str for Name fields in semantic objects - FunctionType.Arguments should be an Array - Un-wtfized python's qualified identifiers. Updated SDK. Regenerated tests - Update fixtures - Map normal arg as uast.Argument - Changes to run go test locally - Changes some files to "go test" can be run only running `make native-build`. Unfortunately, this breaks `make test` and `make integration-test`. WIP. - Add missing file - Correct the column of QualifiedIdentifier children - Fix comments - Fix make test Signed-off-by: Juanjo Alvarez <juanjo@sourced.tech> rebase this Signed-off-by: Juanjo Alvarez <juanjo@sourced.tech>
Signed-off-by: Juanjo Alvarez <juanjo@sourced.tech>
Signed-off-by: Juanjo Alvarez <juanjo@sourced.tech>
Signed-off-by: Juanjo Alvarez <juanjo@sourced.tech>
Signed-off-by: Juanjo Alvarez <juanjo@sourced.tech>
Signed-off-by: Juanjo Alvarez <juanjo@sourced.tech>
Signed-off-by: Denys Smirnov <denys@sourced.tech>
Signed-off-by: Juanjo Alvarez <juanjo@sourced.tech>
Signed-off-by: Juanjo Alvarez <juanjo@sourced.tech>
|
Checking why CI fails. |
Signed-off-by: Denys Smirnov <denys@sourced.tech>
Signed-off-by: Denys Smirnov <denys@sourced.tech>

Status: