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

Go to definition doesn't work for singleton operations #646

Closed
jiribenes opened this issue Oct 18, 2024 · 0 comments · Fixed by #681
Closed

Go to definition doesn't work for singleton operations #646

jiribenes opened this issue Oct 18, 2024 · 0 comments · Fixed by #681
Assignees
Labels
bug Something isn't working quality-of-life

Comments

@jiribenes
Copy link
Contributor

jiribenes commented Oct 18, 2024

effect raise(): Unit
def example(): Unit / raise = do raise()

Go to definition doesn't work:

  • neither for the effect annotation (the / raise part),
  • nor for the effect operation (the do raise()).

Both return an unfriendly pop-up: Screenshot 2024-10-18 at 21 23 34


However it works perfectly fine for interfaces and their operations:

interface Exc { def raise(): Unit }
       // ~~~

def example(): Unit / Exc = do raise()

Here, go to definition on both / Exc and do raise() jumps to the ~~~ highlighted area above.

Relevant code

I think there's some missing position info here:

// effect <NAME>[...](...): ...
def operationDef(): Def =
nonterminal:
`effect` ~> operation() match {
case op @ Operation(id, tps, vps, bps, ret) =>
// TODO is the `true` flag used at all anymore???
InterfaceDef(IdDef(id.name), tps, List(Operation(id, Nil, vps, bps, ret) withPositionOf op))
}
def operation(): Operation =
nonterminal:
idDef() ~ params() ~ returnAnnotation() match {
case id ~ (tps, vps, bps) ~ ret => Operation(id, tps, vps, bps, ret)
}
def interfaceDef(): InterfaceDef =
nonterminal:
InterfaceDef(`interface` ~> idDef(), maybeTypeParams(), `{` ~> manyWhile(`def` ~> operation(), `def`) <~ `}`)

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

Successfully merging a pull request may close this issue.

1 participant