-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
VM doesn't fully treat get as a pseudo keyword #379
Comments
This comment was originally written by @mhausner This is currently a bug in the VM. My main concern is that with allowing get and set to be "pseudo-keywords", the semantics of get f() { ... } are unclear. Is this a function f returning a value of type get, or is it a getter f that has no return type specified. |
This comment was originally written by [email protected] Thanks for the quick reply! I think that your concern is resolved by the current behavior of the VM on PseudoKWNegativeTest. This prohibits the use of pseudo keywords as type names - but not as member names. I've opened a separate issue #356 to track this one, but I hope that we can resolve that issue in favor of the current VM behavior and address this ambiguity at the same time. Of course, if someone wanted to just make all of the current dart keywords true keywords for the v1 release I would also be very supportive of that change. Removed Priority-High label. |
This comment was originally written by @mhausner The behavior currently implemented in the VM reflects the understanding we had earlier in the year that pseudo-keywords are proper keywords "at the top level", that is outside of a function block. From this it follows that get or set can be used as local variable names, but not as type, function, field or parameter name. The spec does say something different than what I describe above. Gilad will revisit the issue. Personally, I'd love to see all pseudo-keywords be proper keywords. |
Over to Gilad to clarify. Set owner to @gbracha. |
The spec now disallows built-in identifiers as types, but tolerates them with warnings otherwise. Using them is terrible style, and the warnings are no doubt enough to annoy anyone who likes the idea. The only reason for tolerating this usage is to ease conversion from other languages (mainly JS). Added Done label. |
2019-06-11 [email protected] More fixes to cast response to Stream<List<int>> (#385) 2019-06-11 [email protected] Pass Uint8List to Datagram (#382) 2019-06-11 [email protected] Cast HttpRequest and HttpClientResponse streams to List<int> (#384) 2019-06-10 [email protected] Fixes #364. Change expected result to null for default values of clientMaxWindowBits and serverMaxWindowBits 2019-06-07 [email protected] Fixes #380. Added tests for logical and bitwise operations via type aliases 2019-06-07 [email protected] Additional fix for #373. Code style improved and more strict pattern checking 2019-06-06 [email protected] Fix for #380. Added tests for type aliases for built-in types. Test string concatenation and arithmetic operations 2019-06-05 [email protected] Fixes #380. Added tests for type aliases for built-in types initialization 2019-06-05 [email protected] Fixes #373. Expect reasonable file mode on Unix 2019-06-04 [email protected] Fixes #379. Numerous fixes for io/Process tests 2019-06-04 [email protected] Fixes #378. Use Platform.resolvedExecutable instead of 'dart' command 2019-06-04 [email protected] Fixed Issue #375: it's possible that IPv6 loopback does not exist. 2019-06-04 [email protected] Fixed Issue #236: host.host can be either "localhost" or Platform.localHostname. 2019-06-04 [email protected] Issue #370, instantiate-to-bounds: added static tests for non-function type aliases. 2019-06-04 [email protected] Fix for #377. Use correct network interface type name (IPvX) 2019-06-04 [email protected] Fixes #374. Change pattern for error messages 2019-06-04 [email protected] Issue #370, instantiate-to-bounds: added dynamic tests for non-function type aliases. 2019-06-04 [email protected] Fix for #372. Expect.fail() on timeout added 2019-06-04 [email protected] Fixes #371. Remove excessive asyncStart() 2019-06-03 [email protected] Issue #147, test super bounded types: added tests for non-function type aliases. 2019-05-30 [email protected] Fixes #369. Use correct type arguments to avoid errors 2019-05-30 [email protected] Fixes #368. Don't try to bind system port 2019-05-30 [email protected] Fixes #367. Remove excessive asyncStart() 2019-05-30 [email protected] Fixes #366. Change expected result to SocketException [email protected] Change-Id: I137689755907b3333e597d7d210db2b4d37d70d0 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105641 Reviewed-by: Alexander Thomas <[email protected]> Reviewed-by: William Hesse <[email protected]>
This issue was originally filed by [email protected]
I've recently fixed a bug in frog to allow get and set to be used as member names - as I believe they are allowed by the spec. When I tried to use this feature in the frog compiler, I got a parse error from the VM.
I believe that this should be allowed by the spec and is one of the most useful things that we get out of the otherwise somewhat interesting decision to include pseudo-keywords in a v1 language spec. I'd love to get a fix for this, but even more valuable would be a quick response to let me know if you do consider this a bug in the VM or if it is my misreading of the spec. The High priority is just to verify if this is or is not a VM bug - so that I don't take frog down the wrong road. The actual fix is a much lower priority as this is easy enough to work around.
The code that is responsible for the error is this method declaration in frog/value.dart (Note: not currently checked in as that would break our VM tests <smile>).
Value get(MethodGenerator context, String name, Node node) { ... }
Errors encountered while loading script: '/Users/jimhug/dartfrog/dart/frog/frogc.dart': Error: line 6 pos 1: library handler failed: '/Users/jimhug/dartfrog/dart/frog/lang.dart': Error: line 26 pos 1: library handler failed: '/Users/jimhug/dartfrog/dart/frog/value.dart': Error: line 34 pos 12: identifier expected
Value get(MethodGenerator context, String name,
import('lang.dart');
^
The text was updated successfully, but these errors were encountered: