Skip to content

sort output of definitions in repl, fixes #8677 #9005

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 2 commits into from
May 25, 2020

Conversation

rethab
Copy link
Contributor

@rethab rethab commented May 19, 2020

As opposed to the earlier version, this PR now only fixes #8677, which makes it much smaller.

Note that this change basically reverts d9549fa, which order output on a lower level, but the new order should still be deterministic. This is the reason I had to change some of the tests: the order is no longer alphabetical there.

Copy link
Member

@dottybot dottybot left a comment

Choose a reason for hiding this comment

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

Hello, and thank you for opening this PR! 🎉

All contributors have signed the CLA, thank you! ❤️

Have an awesome day! ☀️

@rethab
Copy link
Contributor Author

rethab commented May 19, 2020

@unkarjedy can you please let me know if this fixes #8678 for you or let me know if you need something else?

/edit: changing the reporting is no longer part of this PR

vals.map(rendering.renderVal).flatten
).foreach(str => out.println(SyntaxHighlighting.highlight(str)))
val formattedMembers = (
typeAliases.map(ta => ("// defined alias " + ta.symbol.showUser, ta.symbol.coord.toSpan)) ++
Copy link
Member

Choose a reason for hiding this comment

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

You can directly call span on a Symbol

@rethab rethab force-pushed the 8677/output-lines-order branch 3 times, most recently from b137f3f to 9d11cf6 Compare May 25, 2020 08:02
@rethab rethab changed the title add reporter for repl, fixes #8677, fixes #8678 sort output of definitions in repl, fixes #8677 May 25, 2020
@rethab rethab force-pushed the 8677/output-lines-order branch 2 times, most recently from 3a1a3b0 to 78adcc8 Compare May 25, 2020 09:27
@rethab rethab marked this pull request as ready for review May 25, 2020 09:30
@rethab rethab requested a review from smarter May 25, 2020 09:30
@rethab
Copy link
Contributor Author

rethab commented May 25, 2020

@smarter please note the updated description.

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.

Otherwise LGTM!

@@ -264,7 +280,7 @@ class ReplDriver(settings: Array[String],
name.startsWith(str.REPL_RES_PREFIX) && hasValidNumber && sym.info == defn.UnitType
}

def displayMembers(symbol: Symbol) = if (tree.symbol.info.exists) {
def displayMembers(symbol: Symbol): (State, Seq[Diagnostic]) = if (tree.symbol.info.exists) {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe rename this to something else like formatMembers since it doesn't directly display anything anymore?

@@ -323,7 +323,7 @@ class ReplDriver(settings: Array[String],
.find(_.symbol.name == newestWrapper.moduleClassName)
.map { wrapperModule =>
val formattedTypeDefs = typeDefs(wrapperModule.symbol)
val (newState, formattedMembers) = displayMembers(wrapperModule.symbol)
val (newState, formattedMembers) = extractAndFormat(wrapperModule.symbol)
Copy link
Member

Choose a reason for hiding this comment

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

typo:

Suggested change
val (newState, formattedMembers) = extractAndFormat(wrapperModule.symbol)
val (newState, formattedMembers) = extractAndFormatMembers(wrapperModule.symbol)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are too fast -- I already changed it locally but haven't pushed yet :)

@rethab rethab force-pushed the 8677/output-lines-order branch from f8c3a63 to 2f5bc4f Compare May 25, 2020 10:50
@rethab rethab force-pushed the 8677/output-lines-order branch from 2f5bc4f to f5db076 Compare May 25, 2020 10:58
@rethab rethab force-pushed the 8677/output-lines-order branch from f5db076 to 34371fa Compare May 25, 2020 10:58
@rethab
Copy link
Contributor Author

rethab commented May 25, 2020

There was one test failure in the worksheet tests which I didn't see before. Also, I squashed all code changes together.

Hopefully CI now becomes green.

@rethab
Copy link
Contributor Author

rethab commented May 25, 2020

@smarter should be ready to merge now :)

@smarter smarter merged commit 54360d0 into scala:master May 25, 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

Successfully merging this pull request may close these issues.

REPL: output lines order doesn't match input definitions order
3 participants