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

Rollup lost an entire piece of code #3533

Closed
arguiot opened this issue May 3, 2020 · 4 comments · Fixed by #3539
Closed

Rollup lost an entire piece of code #3533

arguiot opened this issue May 3, 2020 · 4 comments · Fixed by #3539

Comments

@arguiot
Copy link

arguiot commented May 3, 2020

  • Rollup Version: v2.7.3
  • Operating System (or Browser): macOS Catalina 10.15.5 on Safari
  • Link to reproduction (IMPORTANT, read below):

Here is the REPL link.

I didn't past all my code as it's private, but this roughly what happened. Here are screenshots of the result I'm getting:
Capture d’écran 2020-05-03 à 19 15 27

I managed to find a workaround by not having a list constant:
Capture d’écran 2020-05-03 à 19 16 55

Expected Behavior

Rollup should always keep the code when not certain if it's accessible or not. So it doesn't lose any important code

Actual Behavior

Inside a class, Rollup lost an entire piece of code for no reason. Maybe Rollup thought that the code wasn't accessible.

If you ever need the real code to fix the issue, please tell me here, so I can share the code by email.

@lukastaegert
Copy link
Member

If code is missing, then Rollup did not find a side-effect. The important part would be to see the original code of the monitor function without your fix so that I can understand what side-effect was overlooked.

@arguiot
Copy link
Author

arguiot commented May 4, 2020

Concerning the original code of the monitor function, here it is:

monitor() {
  const persons = [this.bob, this.alice, this.charlie, this.david]
  const list = persons.filter(person => person.isPark)
  list.forEach(p => {
            list.forEach(pp => {
                if (p == pp) {
                    return
                }
                const diffX = p.x - pp.x;
                const diffY = p.y - pp.y;

                const dist = Math.sqrt(diffX * diffX + diffY * diffY);
                if (dist <= 40) {
                    this.contact(p, pp)
                }
            })
        })
}

@lukastaegert
Copy link
Member

Thanks again, pending fix at #3539

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

Successfully merging a pull request may close this issue.

2 participants