Comments (9)
I think that error message explains itself fairly well.
from d-scanner.
I know, but it's still a bug: D code in production still relies on it (in rdmd etc); it should be a warning, not an error, and at least parse the rest of the file even if it skips this declaration.
from d-scanner.
The fact that DMD still supports C syntax at all is a bug because it doesn't do so properly. http://d.puremagic.com/issues/show_bug.cgi?id=953
from d-scanner.
I agree it is a misfeature, but both ldc and dmd accept it, so dscanner should match their behavior.
phobos uses that in many files, and many D production 3rd party libs do too.
If dscanner deviates, it just won't be usable with those.
I see nothing wrong with just reporting a warning instead of errro (besides additional coding time of course :-) ).
from d-scanner.
I don't think emitting a warning is enough, since you'd end up with a wrong AST tree. You need to actually implement parsing for this, but why bother doing all that work for a deprecated feature?
The only reason I could think of implementing this is if you wanted to auto-translate deprecated syntax into the proper syntax. But in that case such a conversion app can override parseDeclarator
in its parser subclass and add this support. There's no need to add it to Dscanner itself.
I think we should close this. @Hackerpilot?
from d-scanner.
I agree with @timotheecour - in order to do AST->source conversion properly, dscanner should parse whatever dmd does (bugs in dmd aside). We can always warn about it, let the user decide whether they want to treat it as any error.
Far as I can tell, dmd only allows array decls (it doesn't do the semantic properly as noted, but it shouldn't matter):
Type ident TypeSuffix* (= init)? (, more)?
Where only arrays are allowed (syntactically). I have a possible patch for this here: https://github.com/callumenator/Dscanner/tree/c-style
Basically, it just adds a typesuffix array to the declarator, and parses typesuffixes after the identifier when it sees an opening [
. In my tests on phobos AST->source, this has no adverse affects and allows c-style usage that appears in some unittests. Thoughts?
from d-scanner.
Note dmd also allows them for parameters:
void a(int b[]){}
This appears in phobos (regex at least)
from d-scanner.
Support for variables with c-style array syntax is present in libdparse now. I'm leaving this open since it seems dscanner does not dump the correct AST for c-style array function parameters.
from d-scanner.
this is accepted now in dparse.
from d-scanner.
Related Issues (20)
- "Could not resolve location of module" errors with newest LDC HOT 3
- Warn about negating unsigned (uint/ulong etc)
- Warn about accessing private members in documented `unittest`s HOT 3
- Static array expressions not fully supported HOT 1
- dscanner should pass its own style check HOT 1
- Warn about functions that are `@disable` but have an function body
- Trying to build using Ubuntu 20.04 packages HOT 6
- [warning] first.d:visit Could not resolve location of module ... HOT 4
- wrongful label_var_same_name_check
- Interactive fix is not working for me HOT 4
- Support additional themes for HTML highlighting HOT 1
- Support `alias this = _base;`
- use dscanner to replace phobos style_lint_shellcmds
- add warnings for known useless / avoidable memory-allocations (especially in phobos) HOT 1
- Support for compilation database HOT 1
- AssertError on style check HOT 1
- Respect `excludedSourceFiles` when scanning sources HOT 5
- Skip lint on given line / function / class .. HOT 1
- label_var_same_name triggered for non-static members in static functions HOT 1
- dscanner.ini settings get ignored when adding ModuleFilters
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 d-scanner.