Skip to content
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

Support "constructor" syntax #69

Merged
merged 9 commits into from Apr 19, 2018
Merged

Support "constructor" syntax #69

merged 9 commits into from Apr 19, 2018

Conversation

ice1000
Copy link
Contributor

@ice1000 ice1000 commented Apr 18, 2018

According to #68

  • Fixed compilation errors under IDEA 2018.1
  • Applied some IntelliJ IDEA suggestions
  • Use Kotlin 1.2.31 which generates better optimized bytecode
  • Support "constructor" syntax but didn't provide full support like completions or stubs
  • Added corresponding parser unit test

@ice1000
Copy link
Contributor Author

ice1000 commented Apr 18, 2018

Why doesn't this compile? I don't think changing to 2018.1 will cause the strange compilation error shown in the CI log.

I can compile it and run tests on my laptop.

@ice1000
Copy link
Contributor Author

ice1000 commented Apr 18, 2018

All failed tests are under SolidityCompleteOfficialFailingParsingTest, which looks like they're failing by design.

Copy link
Member

@SerCeMan SerCeMan left a comment

Choose a reason for hiding this comment

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

Thanks for this. I'll take one and will merge it today 👍

if (ijEvent == null) {
return true
}
val ijEvent = events.firstOrNull() ?: return true
Copy link
Member

Choose a reason for hiding this comment

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

I intentionally try to avoid nullable ?: return smth idiom because it often hides the control flow in debugging, e.g. it's often unclear at which moment the method gets returned.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, reverted.

@SerCeMan
Copy link
Member

Oh, just noticed messages about the errors, I'll try to check why

@SerCeMan
Copy link
Member

which looks like they're failing by design.

The generated AST has probably changed

@ice1000
Copy link
Contributor Author

ice1000 commented Apr 19, 2018

The generated AST has probably changed

Have you mentioned my change in the .bnf file? I don't think simply adding an alternative branch to ContractPart will affect other AST structures..

@SerCeMan
Copy link
Member

Have you mentioned my change in the

I haven't tried to run these tests locally yet, but you can try to regenerate lexer/parser (there is a run configuration for this), and run the test locally to see the difference. If there is no difference then I can't say off the top of my head what's wrong, but I'll take a look.

@ice1000
Copy link
Contributor Author

ice1000 commented Apr 19, 2018

@SerCeMan Fixed test cases. It's actually the difference of the error message.

@codecov-io
Copy link

Codecov Report

Merging #69 into master will decrease coverage by 0.05%.
The diff coverage is 87.27%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master      #69      +/-   ##
============================================
- Coverage     47.82%   47.77%   -0.06%     
  Complexity      116      116              
============================================
  Files            78       78              
  Lines          2022     2018       -4     
  Branches        366      363       -3     
============================================
- Hits            967      964       -3     
- Misses          933      935       +2     
+ Partials        122      119       -3
Impacted Files Coverage Δ Complexity Δ
src/main/kotlin/me/serce/solidity/ide/structure.kt 0% <ø> (ø) 0 <0> (ø) ⬇️
src/main/kotlin/me/serce/solidity/lang/language.kt 69.23% <ø> (-10.77%) 0 <0> (ø)
...lin/me/serce/solidity/ide/run/SolidityRunConfig.kt 0% <0%> (ø) 0 <0> (ø) ⬇️
.../serce/solidity/ide/colors/SolColorSettingsPage.kt 0% <0%> (ø) 0 <0> (ø) ⬇️
...e/solidity/ide/run/compile/SolcMessageProcessor.kt 0% <0%> (ø) 0 <0> (ø) ⬇️
...c/main/kotlin/me/serce/solidity/ide/highlighter.kt 98% <100%> (-0.04%) 0 <0> (ø)
...olidity/ide/refactoring/RenameContractProcessor.kt 80% <100%> (+40%) 5 <0> (ø) ⬇️
...dity/ide/refactoring/RenameConstructorProcessor.kt 100% <100%> (+33.33%) 5 <1> (ø) ⬇️
...ang/resolve/ref/SolUserDefinedTypeNameReference.kt 80% <0%> (-4%) 3% <0%> (ø)
...in/kotlin/me/serce/solidity/lang/resolve/engine.kt 84.78% <0%> (-0.73%) 0% <0%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 632bb6e...2f7f443. Read the comment docs.

Copy link
Member

@SerCeMan SerCeMan left a comment

Choose a reason for hiding this comment

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

Looks great to me!

@SerCeMan SerCeMan merged commit 19f1a25 into intellij-solidity:master Apr 19, 2018
@Kipriz
Copy link

Kipriz commented Apr 23, 2018

When are you planning to make a release with this PR?

@SerCeMan
Copy link
Member

SerCeMan commented Apr 23, 2018

Hey, @Kipriz! Probably this week, there are some issues/features that require additional testing, in the meantime, you can build a version from master using the instructions in README

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.

None yet

4 participants