-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[WIP] fix encoding issues #1494
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
Conversation
@@ -0,0 +1 @@ | |||
-encoding UTF16 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.flags file are currently ignored by partest, and I'm not sure if there's any way to have a run test with a special set of flags currently.
/cc @DarkDimius : If we make a run-special
folder like pos-special
, will its content be treated as run-tests by partest?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@smarter That makes me realize this doesn't actually have to be a run test, as it won't compile anyway if it doesn't have the -encoding flag set to UTF-16. Should it be moved?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you should move it to pos-special and add a line next to https://github.com/lampepfl/dotty/blob/d84805299a42cb8d2c756aff5a117af24dbeaaf4/test/dotc/tests.scala#L113 like:
@Test def pos_utf16encoded = compileFile(posSpecialDir, "utf16encoded", List("-encoding", "UTF16"))
8450ff0
to
663db29
Compare
663db29
to
620394c
Compare
rename test/pos/valueclasses to pos_valueclasses tests/pos/valueclasses generates a valueclasses.flags file in /tests/partest-generated/pos that conflicts with the valueClasses.flags file that tests/neg/valueClasses.scala tries to create
620394c
to
32819e2
Compare
5e8e2c4
to
46b3253
Compare
And that's a passing test-suite. I'm particularly uncertain about what I did at 32819e2 Should that be split up in the part where -encoding and default UTF8 encoding are honored, and the test renames? Should neg/valueClasses.scala be renamed rather than pos/valueclasses/? I'm also not too happy with the manual bitwise copy, which seems out of place in 6bce106 |
I'll have a closer look at this during the week-end, on Windows at home. |
@@ -49,7 +49,7 @@ class TestREPL(script: String) extends REPL { | |||
out.close() | |||
val printed = out.toString | |||
val transcript = printed.drop(printed.indexOf(config.prompt)) | |||
if (transcript.toString != script) { | |||
if (transcript.toString.lines.toList != script.lines.toList) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can avoid the reification as List
s with sameElements
:
if (transcript.toString.lines.sameElements(script.lines))
Why renaming some pos tests with |
@@ -228,7 +228,7 @@ abstract class CompilerTest { | |||
|
|||
private def expectedErrors(filePath: String): List[ErrorsInFile] = expectedErrors(List(filePath)) | |||
|
|||
private def isNegTest(testPath: String) = testPath.contains(JFile.separator + "neg" + JFile.separator) | |||
private def isNegTest(testPath: String) = testPath.contains("/neg/") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this change have been part of another commit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
32819e2 should probably be broken up in just the part that fixes dotty not honoring default and passed in -encoding arguments (which is an actual bug in dotty) and the parts that get the tests running on Windows (which is "just" a set of test-suite bugs). WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds good :)
out.close() | ||
} else { | ||
try { | ||
SFile(dest)(scala.io.Codec.UTF8).writeAll((s"/* !!!!! WARNING: DO NOT MODIFY. Original is at: $file !!!!! */").replace("\\", "/"), file.slurp("UTF-8")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the .replace("\\", "/")
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some path parts start with u
. Then comment then contains \u(something)
, which gets interpreted as an invalid unicode escape, failing compilation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah ah!
Well, that deserves to be written as a comment above this line, then, IMO.
That's all I have. Note: on my Windows machine,
|
No, on my Windows machine sbt test passes everything. I'll first get to work on your comments; that's plenty for now. Maybe after that we can see if there are failing tests in different environments? |
As this improves the current state - we're merging this. Thanks for your contribution @martijnhoekstra ! |
The one-parameter constructor of SourceFile was removed in scala#1494
@felixmulder thank you for merging it, and my sincere apologies for not coming back to this in a timely manner. I'll investigate the remainder of the cleanup that's still to be done, and make sure it gets solved. |
No need to apologize, your contribution improved the project -- therefore we merged it, simple as that. We'd be very grateful for further improvements on the windows side, as nobody at the lab currently uses windows. Cheers, |
the -encoding compiler flag wasn't honored at all.
Behind a WIP flag, because it depends on the earlier PR with the other test fixes for Windows, as it's very hard to build something isolated when the tests are still failing, and will need to get rabased and cleaned up at some point.