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

Parser should report ambiguous givens syntax #22197

Open
WojciechMazur opened this issue Dec 11, 2024 · 0 comments
Open

Parser should report ambiguous givens syntax #22197

WojciechMazur opened this issue Dec 11, 2024 · 0 comments
Labels
area:parser area:reporting Error reporting including formatting, implicit suggestions, etc better-errors Issues concerned with improving confusing/unhelpful diagnostic messages itype:enhancement

Comments

@WojciechMazur
Copy link
Contributor

Compiler version

3.6

Minimized example

trait Arg
trait Ret

given what: () => Arg => Ret = ??? // error
// ambigious but not handled

given what1: () => (Arg => Ret) = ??? 
// implicit def what(): (Arg => Ret) = ???

given what2: (() => Arg) => Ret = ??? 
// implicit def what(ctx: () => Arg): Ret = ???

given what3: (() => Arg => Ret) = ???
// implicit lazy val: (() => Arg => Ret) = ???

Output Error/Warning message

-- Error: /Users/wmazur/projects/scala/sandbox/test.scala:4:22 ---------------------------------------------------------------------------------------------------------------------------------------------
4 |given what: () => Arg => Ret = ??? // error
  |                      ^^
  |                      end of toplevel definition expected but '=>' found

Why this Error/Warning was not helpful

No context on how to fix the code

Suggested improvement

Inform that given definition is ambigious, recommend placing using paranthesis to fix the expression

@WojciechMazur WojciechMazur added itype:enhancement area:reporting Error reporting including formatting, implicit suggestions, etc area:parser better-errors Issues concerned with improving confusing/unhelpful diagnostic messages labels Dec 11, 2024
@SethTisue SethTisue changed the title Parser should report ambiogious givens syntax Parser should report ambiguous givens syntax Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:parser area:reporting Error reporting including formatting, implicit suggestions, etc better-errors Issues concerned with improving confusing/unhelpful diagnostic messages itype:enhancement
Projects
None yet
Development

No branches or pull requests

1 participant