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

SNAP: setup and translv has wrong location #62

Open
certik opened this issue Dec 28, 2024 · 5 comments
Open

SNAP: setup and translv has wrong location #62

certik opened this issue Dec 28, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@certik
Copy link
Contributor

certik commented Dec 28, 2024

Finding definitions from the main program leads to this location:

image

Which is the right file and it's almost correct, but it should be 5 lines earlier, the column seems incorrect too.

@certik certik added the bug Something isn't working label Dec 28, 2024
@dylon
Copy link
Collaborator

dylon commented Dec 28, 2024

The location information for translv comes from lfortran:

lfortran --lookup-name --continue-compilation -I. --line=102 --column=32 snap_main.f90 | jq
[
  {
    "kind": 12,
    "location": {
      "range": {
        "start": {
          "character": 29,
          "line": 10
        },
        "end": {
          "character": 22,
          "line": 400
        }
      },
      "uri": "translv.f90"
    },
    "name": "translv",
    "filename": "translv.f90"
  }
]

@certik
Copy link
Contributor Author

certik commented Dec 29, 2024

Thanks, made this lfortran/lfortran#5860 (comment).

@Pranavchiku
Copy link
Member

MRE:

a.f90

PROGRAM snap_main

  USE setup_module, ONLY: setup
  IMPLICIT NONE
  INTEGER :: ierr, i
  CALL setup ( )

END PROGRAM snap_main

b.f90

MODULE setup_module
  CONTAINS

  SUBROUTINE setup ( )
    INTEGER :: flg, &
      mie

  END SUBROUTINE setup
END MODULE setup_module
% lfortran a.f90 --line=6 --column=9 --lookup-name | jq
[
  {
    "kind": 12,
    "location": {
      "range": {
        "start": {
          "character": 11,
          "line": 4
        },
        "end": {
          "character": 22,
          "line": 8
        }
      },
      "uri": "b.f90"
    },
    "name": "setup",
    "filename": "b.f90"
  }
]

@Pranavchiku
Copy link
Member

This is tricky, I am trying to debug we are correctly mapping as well but the highlight is shifted by an offset.

@certik
Copy link
Contributor Author

certik commented Dec 29, 2024

I think it's the & in the module. When we save it to a .mod file, and load it, I think we do not correctly take into account the remapping that happens due to the prescanner handling of &.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants