Skip to content

Improve message when directory is passed dotc. #1556

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
Oct 10, 2016
Merged

Improve message when directory is passed dotc. #1556

merged 1 commit into from
Oct 10, 2016

Conversation

olafurpg
Copy link
Contributor

@olafurpg olafurpg commented Oct 6, 2016

Previously, running ./bin/dotc caused a null pointer
exception. Now, the error is:

error: expected file, received directory <directory>

@@ -30,7 +30,7 @@ object Formatting {
catch {
case NonFatal(ex) => s"[cannot display due to $ex, raw string = $toString]"
}
case _ => arg.toString
case _ => s"$arg"
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this related/relevant to the PR?

Copy link
Contributor

Choose a reason for hiding this comment

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

It does not look like it - @olafurpg, could you remove this from the PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The NPE that triggered this PR originated from arg being null so I wrapped it into quasiquotes.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see, however, I still don't think we should be allowing null.show.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's arguably better if this blows up :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fine, I've removed the change.

Copy link
Contributor

@felixmulder felixmulder left a comment

Choose a reason for hiding this comment

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

Looks good to me except for the change in Formatting.scala.

@@ -30,7 +30,7 @@ object Formatting {
catch {
case NonFatal(ex) => s"[cannot display due to $ex, raw string = $toString]"
}
case _ => arg.toString
case _ => s"$arg"
Copy link
Contributor

Choose a reason for hiding this comment

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

It does not look like it - @olafurpg, could you remove this from the PR?

Previously, running ./bin/dotc <directory> caused a null pointer
exception. Now, the error is:

  error: expected file, received directory 'bin'
@olafurpg
Copy link
Contributor Author

I've rebased now.

@felixmulder felixmulder merged commit 9ef0341 into scala:master Oct 10, 2016
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.

3 participants