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

New givens syntax does no logger accepts valid given defintions #21768

Open
WojciechMazur opened this issue Oct 15, 2024 · 1 comment · May be fixed by #21957
Open

New givens syntax does no logger accepts valid given defintions #21768

WojciechMazur opened this issue Oct 15, 2024 · 1 comment · May be fixed by #21957
Assignees
Labels
area:implicits related to implicits area:parser itype:bug regression This worked in a previous version but doesn't anymore

Comments

@WojciechMazur
Copy link
Contributor

WojciechMazur commented Oct 15, 2024

Based on OpenCB failure in jphmrst/scala-automata - build logs
Affects also:

The new givens syntax and its changes to the parser no longer accept valid old (pre 3.6.0) givens syntax, in cases when type of the type-class is moved to the next line. It's a common issue that might be introduced by automatic code formatters when dealing with long names or signatures of given.

Compiler version

Last good release: 3.6.0-RC1-bin-20241003-a672e05-NIGHTLY
First bad release: 3.6.0-RC1-bin-20241005-6fa81cf-NIGHTLY

Bisect points to: 14acdc0

Minimized code

trait Typeclass[T]:
  def op(v: T): Unit

given namedGivenWithLongName[T]:
  Typeclass[T] with
    override def op(v: T): Unit = ???

given otherNamedGivenWithLongName[T]:
  Typeclass[T] = new Typeclass[T]:
    override def op(v: T): Unit = ???

Output

[error] ./test2.scala:5:16
[error] end of statement expected but 'with' found
[error]   Typeclass[T] with
[error]                ^^^^
[error] ./test2.scala:4:7
[error] Not found: type namedGivenWithLongName
[error] given namedGivenWithLongName[T]:
[error]       ^^^^^^^^^^^^^^^^^^^^^^
[error] ./test2.scala:4:30
[error] Not found: type T
[error] given namedGivenWithLongName[T]:
[error]                              ^
[error] ./test2.scala:5:13
[error] Not found: type T
[error]   Typeclass[T] with
[error]             ^
[error] ./test2.scala:5:3
[error] Not found: Typeclass
[error]   Typeclass[T] with
[error]   ^^^^^^^^^

Workaround

Compile with -source:3.5

Expectation

It should compile and be parsable until deprecating the old syntax.

@WojciechMazur WojciechMazur added itype:bug area:parser regression This worked in a previous version but doesn't anymore labels Oct 15, 2024
@WojciechMazur WojciechMazur changed the title New givens syntax does no logger accept valid given defintions New givens syntax does no logger accepts valid given defintions Oct 15, 2024
@Gedochao Gedochao added the area:implicits related to implicits label Oct 17, 2024
@Gedochao
Copy link
Contributor

cc @odersky

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:implicits related to implicits area:parser itype:bug regression This worked in a previous version but doesn't anymore
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants