-
Notifications
You must be signed in to change notification settings - Fork 323
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
Parser: Parse UUIDs; implement comments in AST; implement type annotations and signatures; fix field names #3653
Conversation
925f9da
to
df9177d
Compare
df9177d
to
5818dac
Compare
5818dac
to
65b9a4a
Compare
65b9a4a
to
1a81610
Compare
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.
I am concerned by the number of JNI calls we may need to do to read metadata...
…nnotations and signatures; fix field names #3653
I've just merged this PR into #3611 as d4e5a4b and there is one new failure when running the enso$ sbt --java-home /graalvm
sbt:enso> project runtime
sbt:runtime> testOnly *EnsoCompilerTest*
[error] Test org.enso.compiler.EnsoCompilerTest.testComment failed: IR for ## A type representing computations that may fail.
[error] type Maybe
[error] shall be equal expected:<...ings = List(
[error] IR.[Comment.Documentation(
[error] doc = A type representing computations that may fail.,
[error] location = Some(
[error] IdentifiedLocation[_]
[error] ),
[error] passData = Iterable(),
[error] diagnostics = DiagnosticStorage(
[error] diagnostics = List()
[error] ),
[error] id = _
[error] ),
[error] IR.]Module.Scope.Definit...> but was:<...ings = List(
[error] IR.[]Module.Scope.Definit...>, took 0.076 sec
[error] Failed: Total 12, Failed 1, Errors 0, Passed 10, Skipped 1
[error] Failed tests:
[error] org.enso.compiler.EnsoCompilerTest which means the code in this PR no longer recognizes ## A type representing computations that may fail.
type Maybe as documentation comment. The old parser apparently believes this is a documentation comment. |
#[test] | ||
fn type_signatures() { | ||
let cases = [ | ||
("val : Bool", block![(TypeSignature val ":" (Ident Bool))]), |
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.
lib/rust/parser/tests/parse.rs
Outdated
|
||
|
||
#### METADATA #### | ||
[[{"index":{"value":7},"size":{"value":8}},"5bad897e-099b-4b00-9348-64092636746d"],[{"index":{"value":15},"size":{"value":1}},"b803f0a9-51bf-4473-8dc0-5163340feb0a"],[{"index":{"value":16},"size":{"value":4}},"e48f96d6-8349-4c28-8c2a-3ac3c447a53c"],[{"index":{"value":20},"size":{"value":1}},"8adaadf0-443a-4598-bc61-4f85e6b518c2"],[{"index":{"value":21},"size":{"value":4}},"4e3ab45b-4333-4cf3-abb7-ced5b26b5d64"],[{"index":{"value":25},"size":{"value":1}},"a450dc37-ed96-470d-a12a-0a98e43a4002"],[{"index":{"value":26},"size":{"value":3}},"379322e5-b4b6-4c96-8404-348cdec4f2e9"],[{"index":{"value":0},"size":{"value":29}},"1db87a0f-3de5-41bc-bd0f-a4d6738dace9"],[{"index":{"value":37},"size":{"value":8}},"b8d0dcc9-298a-448e-b235-59ad71e2ef68"],[{"index":{"value":45},"size":{"value":1}},"1a8db951-33b6-41f7-b84c-2fda9d34dca2"],[{"index":{"value":46},"size":{"value":4}},"d53a8336-5125-48cb-adc0-99b8f6208fa6"],[{"index":{"value":50},"size":{"value":1}},"26032102-59e8-4e30-84f7-04d6410478bc"],[{"index":{"value":51},"size":{"value":4}},"1f5d99d1-680b-47e9-8599-061289a41201"],[{"index":{"value":55},"size":{"value":1}},"c2fe225b-9fe9-4f10-abb0-d83accd42336"],[{"index":{"value":56},"size":{"value":7}},"64907631-01f4-4a02-acab-a0f55e86eed4"],[{"index":{"value":30},"size":{"value":33}},"836d67f0-b0df-421f-8ac3-099e952d0050"],[{"index":{"value":71},"size":{"value":8}},"f7d49db0-6a18-45a0-9279-ac04cb25740b"],[{"index":{"value":79},"size":{"value":1}},"73ade9b0-f3a0-4483-9cfb-a355541cbf6b"],[{"index":{"value":80},"size":{"value":4}},"5d3b79ef-7d37-4a46-8e73-b0c01f8463a9"],[{"index":{"value":84},"size":{"value":1}},"0097b595-7d58-4ebf-bc1a-9252ee7ea4e0"]] |
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.
When I copy this source and try to parse it with old the Enso parser, it complains:
org.enso.syntax.text.Parser$ParserError: Internal error in parser Expected two lines after METADATA.
at org.enso.syntax.text.Parser.splitMeta(Parser.scala:173)
at org.enso.syntax.text.Parser.runWithIds(Parser.scala:200)
at org.enso.compiler.EnsoCompilerTest.parseTest(EnsoCompilerTest.java:227)
at org.enso.compiler.EnsoCompilerTest.testMetadataCheck(EnsoCompilerTest.java:192)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:566)
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.
The new parser is more accepting (and for now, it only cares about UUIDs, and ignores the second metadata blob). I'll switch the test case to use an untruncated source file.
There is no getter for |
Doc comments have not been implemented in the new parser (it's on the roadmap: https://www.pivotaltracker.com/story/show/182497173). That test must have been relying on treating all comments as doc comments, which is no more correct than treating all comments as machine-invisible plain comments. Sorry for the apparent regression, but in the implementation it's progress. |
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.
Let's get this done and use it in #3611
Combined this into #3674 for easier merge. |
Pull Request Description
Implements:
Important Notes
Checklist
Please include the following checklist in your PR:
Scala,
Java,
and
Rust
style guides.
./run ide build
and./run ide watch
.[ci no changelog needed]