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

Rendering problem in composeLens exercise #675

Open
FRosner opened this issue Jan 4, 2018 · 2 comments
Open

Rendering problem in composeLens exercise #675

FRosner opened this issue Jan 4, 2018 · 2 comments
Assignees

Comments

@FRosner
Copy link
Member

FRosner commented Jan 4, 2018

Problem

The composeLens exercise does not get rendered correctly.

The source code:

  def exerciseComposeLens(res0: Int, res1: Person) = {

    (addressLens composeLens streetNumber).get(john) should be(res0)
    (addressLens composeLens streetNumber).set(2)(john) should be(res1)
  }

How it looks on the web page:

addressLens composeLens streetNumber).get(john) should be( )
    (addressLens composeLens streetNumber).set(2)(john) should be( )

The initial bracket is missing and the second line has an unintended indentation.

Screen Shots

image

@FRosner
Copy link
Member Author

FRosner commented Jan 4, 2018

Maybe it is related to the empty line?

@jdesiloniz jdesiloniz self-assigned this Jan 19, 2018
@joseph-whiting
Copy link

Hi - I took a look at this. It seems to be not to do with the empty line but actually to do with the round brackets. The issue is that for a statement starting with a round bracket the Scala tree parser is identifying the start as the character after the bracket. This means the MethodBodyReader is not working as it should. The indentation is a knock-on effect of this. This bug will only happen when there are two lines or more in a method, and will only affect the bracket of the first line and the indentation of all the others.

I have yet to think of a neat workaround, but will have a pop! I might also ask the Scala compiler/reflection people whether this should be considered a bug with that.

@github-actions github-actions bot removed the ready label Apr 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants