Skip to content

Fix #2901: Make asClass cast only when sure it is a class #2902

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

Merged
merged 1 commit into from
Jul 27, 2017

Conversation

nicolasstucki
Copy link
Contributor

No description provided.

@smarter
Copy link
Member

smarter commented Jul 24, 2017

Why is it possible for the symbol to not be a ClassSymbol here?

@nicolasstucki
Copy link
Contributor Author

nicolasstucki commented Jul 24, 2017

Inliner emits an error but still produces an illegal tree.

@nicolasstucki
Copy link
Contributor Author

@nicolasstucki
Copy link
Contributor Author

I could also move and duplicate val clazz = sup.symbol.asClass

@smarter
Copy link
Member

smarter commented Jul 24, 2017

I would just do:

if (isDisallowed(sym)) {
  ...
} else {
  val clazz = ...
  if (...)
  else if (...)
  ...
}

@nicolasstucki
Copy link
Contributor Author

Done

Copy link
Member

@smarter smarter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, please squash the two commits together before merging.

@nicolasstucki
Copy link
Contributor Author

@smarter changed the fix (even more trivial)

@nicolasstucki nicolasstucki changed the title Fix #2901: Make asClass cast lazy in case of previous errors Fix #2901: Make asClass cast only when sure it is a class Jul 26, 2017
@nicolasstucki nicolasstucki merged commit 74e084f into scala:master Jul 27, 2017
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

Successfully merging this pull request may close these issues.

2 participants