Simplify internal parsing to KtFile's#2875
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2875 +/- ##
============================================
- Coverage 80.28% 80.24% -0.04%
+ Complexity 2417 2414 -3
============================================
Files 421 421
Lines 7359 7356 -3
Branches 1346 1345 -1
============================================
- Hits 5908 5903 -5
Misses 756 756
- Partials 695 697 +2
Continue to review full report at Codecov.
|
00f52cc to
98272d3
Compare
| val errors = mutableListOf<PsiErrorElement>() | ||
| ktFile.accept(object : KtTreeVisitorVoid() { | ||
| override fun visitErrorElement(element: PsiErrorElement) { | ||
| errors.add(element) | ||
| } | ||
| }) | ||
|
|
||
| assertThat(errors).isNotEmpty() |
There was a problem hiding this comment.
Is this a behavioral change now, since you had to adapt the test case?
There was a problem hiding this comment.
Hm, yes it is. Not sure how to handle this.
In KtTreeCompiler we throw an exception if the file ending is not kt or kts.
In the old implementation the PsiFactory tried to use Language.Any and because no language was registered was .css it didn't tried to parse anything and returned null which we checked with error(...).
The KtPsiFactory always tries to parse Kotlin and returns a PsiFile with errors.
@schalkms @BraisGabin @cortinico should we throw an error on wrong file extension like when parsing directories?
There was a problem hiding this comment.
Ok, we ignored it when parsing many files:
No description provided.