Comments (6)
I tried to enable the test and change the line
case Triangle t&&(t.calculateArea() > 100) ->
into
case Triangle t when t.calculateArea() > 100 ->
.
The formatter now crashes, because the when
token is not of type TokenNameRestrictedIdentifierWhen
(131), it's TokenNameIdentifier
(19). Is this something to be fixed in the Scanner
? I see it has a method called disambiguatedRestrictedIdentifierWhen()
, so it looks like it attempts to take care of it.
After we resolve this, I wonder how to handle whitespace around the when
keyboard. Using the settings for logical_operator
is no longer intuitive. I think we can always add spaces, they're usually necessary anyway (except for when the pattern or expression is in parentheis).
Also, in JEP some examples keep the when
clause in the same line as the case
clause, while others put in in a new line, I guess we'll need a new formatter setting for that.
from eclipse.jdt.core.
Thanks @mateusz-matela. I will look into that and report back. There's no rush to work on the formatter yet as we are still in early stages of compiler support. You don't mind keeping this on your list till then, do you?
from eclipse.jdt.core.
Scanner went through some changes for this keyword. I tried this again but still tests are failing but looks like a different error now.
from eclipse.jdt.core.
I checked again and it turned out that the Scanner
returns proper tokens when previewEnabled
is set to true, so I did that in the failing test and it works now. It's possible that was the problem from the beginning.
Please verify in the PR that I set this option properly (will it stay there forever, or be removed when we're out of beta? maybe it should be set somewhere else globally?)
from eclipse.jdt.core.
Looks good. Whenever the feature moves from preview to standard, we can remove the option. So, we can close this now?
from eclipse.jdt.core.
I think so, as long as we don't forget to remove the option when appropriate :)
from eclipse.jdt.core.
Related Issues (20)
- [Patterns][records] ECJ fails to generate code to deconstruct record in pattern
- [Patterns] Design smell: Pattern classes are far from object oriented
- IllegalArgumentException using newer batch compiler with ast parser HOT 5
- Migration of JDT wiki pages HOT 2
- Missing resource leak warning for FileInputStream HOT 1
- [Sealed classes] Incorrect Reconciler error: The type A that implements a sealed interface I should be a permitted subtype of I
- [Patterns][records] Wrong warning "The expression of type R is already an instance of type R" with deconstruction patterns
- [Patterns][records] ECJ fails to reject incompatible pattern types.
- Code format HOT 2
- ECJ produces redundant bytecode for instanceof pattern matching HOT 3
- [Patterns] ECJ generates suspect code for switching over patterns
- IrritantSet needs unsigned right shift for GROUP4 and higher HOT 4
- [Patterns][records][inference] ECJ never computes the upwards projection for var type inference in record patterns HOT 3
- [Patterns][unnamed] Support for identifier '_' for old compile source/target versions HOT 2
- [Patterns][internal] toString() output of AST nodes shows up with modifier sealed for pattern variables
- [Switch][Pattern] Withdraw the internal AST APIs Pattern.suspendVariables & Pattern.resumeVariables
- [Patterns][Unnamed] Wasteful allocation and assignment into unnamed pattern variables.
- [Patterns][internal] High degree of code duplication in instanceof pattern code generation
- [Patterns][Unnamed] VerifyError with unnamed pattern variable in instanceof HOT 1
- CommentRecorderParser sometimes generates ranges that miss Javadoc HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eclipse.jdt.core.