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

Compiler confusing property name with effect function name #470

Open
jameswoodleybetenbough opened this issue Feb 14, 2024 · 2 comments
Open

Comments

@jameswoodleybetenbough
Copy link

Expected: When an effect function and a type property have the same name, then the compiler can correctly resolve the function name in the effect handler definition.
Actual: The compiler is unable to discern that the name refers to an effect function handler definition and not the property name of a type. Furthermore, the effect function name is unable to be qualified in any way (that I can think of) that would resolve the issue.

type foo
  Foo
    bar: string

effect some-effect
  fun bar(name: string) : foo

fun main()

  with handler
    fun bar(name) Foo(bar=name)
        ^^^
  //    error: identifier bar cannot be resolved.
  //    context      :         bar(name)
  //    inferred type: (_) -> _
  //    candidates   : bar    : (name : string) -> some-effect foo
  //                   foo/bar: (foo : foo) -> string
  //    hint         : give a type annotation or qualify the name?

  ()
@jameswoodleybetenbough jameswoodleybetenbough changed the title Compiler confusing property name with function name Compiler confusing property name with effect function name Feb 14, 2024
@woojamon
Copy link

Sorry I was signed in under the wrong account when I created the issue.

@TimWhiting
Copy link
Collaborator

We should at minimum qualify the some-effect/bar name, but in handlers we should only consider names that are defined as effect clauses.

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

No branches or pull requests

3 participants