Skip to content

scip-python produces malformatted symbol for every lambda #148

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

Open
jkoppel opened this issue Jan 22, 2024 · 1 comment · May be fixed by #150
Open

scip-python produces malformatted symbol for every lambda #148

jkoppel opened this issue Jan 22, 2024 · 1 comment · May be fixed by #150

Comments

@jkoppel
Copy link

jkoppel commented Jan 22, 2024

Whenever there is a lambda, scip-python will produce a malformatted symbol. Any downstream consumer of SCIP which is expecting spec-compliant output will break.

Reproducing

Create a directory with a single Python file. Call it test-python.py

Add a single line:

f = lambda e: e

cd to that directory and run scip-python index

By running scip print on the generated file, we can see that scip-python has produced a symbol named "local 0(e)". This is bad because the spec does not permit '(' or ')' to appear in identifiers. https://github.com/sourcegraph/scip/blob/main/scip.proto#L155


        &scip.Occurrence{
          Range: []int32{
            0,
            11,
            12,
          },
          Symbol:                "local 0(e)",
          SymbolRoles:           1,
          OverrideDocumentation: []string(nil),
          SyntaxKind:            0,
          Diagnostics:           []*scip.Diagnostic(nil),
          EnclosingRange:        []int32(nil),
        },
        &scip.Occurrence{
          Range: []int32{
            0,
            14,
            15,
          },
          Symbol:                "local 0(e)",
          SymbolRoles:           8,
          OverrideDocumentation: []string(nil),
          SyntaxKind:            0,
          Diagnostics:           []*scip.Diagnostic(nil),
          EnclosingRange:        []int32(nil),
        },

Because of this, any spec-complaint downstream consumer will choke.

In particular, the scip snapshot command fails.

(venv) ubuntu@ip-172-31-88-164:~/scip$ go run ./cmd/scip/ snapshot --from test_python/index.scip
test_python.py: use --strict=false to ignore this error: 2 errors occurred:
	* local 0(e): expected format 'local <simple-identifier>' but got: local 0(e)
	* local 0(e): expected format 'local <simple-identifier>' but got: local 0(e)
exit status 1

Also, the SCIP-importer in Facebook's Glean chokes.

@jkoppel
Copy link
Author

jkoppel commented Jan 23, 2024

Related: sourcegraph/scip-typescript#314

@mmanela mmanela added the Migrated label May 6, 2024 — with Linear
@eseliger eseliger removed the Migrated label May 21, 2024
@linear linear bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants