Comments (4)
cc @dart-lang/language-team
I wrote up some potential test cases in this issue. I'm going to start making language tests for the feature.
Let me know if there's something missing or I should test something in particular.
from sdk.
Multiple
_
are allowed in generic type and generic function type parameters.
Not sure how to read this.
It's out talking about parameters of genetic function types, or about type parameters?
That is, does it allow Function<_, _>()
as a genetic function with two anonymous type parameters?
(I'm fine with that, but it is outside the "local variables only" constraint that I had understood. But I just checked the spec, and that's what it says. So perfectly fine, just hard to read the phrasing.)
Error to have an occurrence of
super._
as a declaration of a formal parameter in a constructor.
Not sure that needs to be an error.
class S {
final int x, y;
S(this.x, this.y);
}
class U extends S {
U(super._ , super._) ;
}
looks perfectly reasonable to me. Only the position matters anyway, the names would only be for documentation or accessing in an initializer list.
If we allow this._
, or a forwarding factory constructor of
factory S.fwd(int _, int _) = S;
(which there is no reason not to allow) then I see no reason to treat super._
differently.
Checked the spec. It disallows super._
because it breaks the current desugaring specification of super parameters.
That's a bad reason for disallowing an otherwise percent good feature, and s good reason for not using desugaring as specification.
I'll suggest changing that, and allowing super._
. even if it means treating _
as binding a fresh name, instead of being a non-binding declaration in that case.
Rest looks fine
from sdk.
Is this one covered?: Every kind of declaration named _
which is specified to be wildcarded is indeed accepted without compile-time errors, and it does not introduce the name _
into the enclosing scope.
The discussion about super._
being an error or not would be taken here: #55661.
from sdk.
Not sure how to read this.
Yeah, it is about generic type parameters. The examples Bob gave were below. I'll name the tests better than these bullets I wrote, hopefully :)
class T<_> {}
void genericFunction<_>() {}
takeGenericCallback(<_>() => true);
Every kind of declaration named
_
which is specified to be wildcarded is indeed accepted without compile-time errors, and it does not introduce the name_
into the enclosing scope.
@eernstg What do you mean by the first part of this line? "Every kind of declaration named _ which is specified to be wildcarded is indeed accepted without compile-time errors". Can you explain this a bit more?
I'll add "it does not introduce the name _ into the enclosing scope " to the list though, thank you.
from sdk.
Related Issues (20)
- Abstract classes with recurring generics could warn on creation of nullable type-solving impossibility HOT 4
- What should `OmittedTypeAnnotation.code` produce? HOT 1
- Frontend type checking error with differing flow control HOT 2
- [breaking change] Add the ability to control minimum TLS version in SecurityContext HOT 3
- [Wildcard Variables] Analyzer Implementation HOT 1
- [Wildcard Variables] Analysis Server Implementation
- Analyzer Feedback from IntelliJ HOT 3
- computeCurrentScript() from d8 preamble fails in VS Code extension host (NodeJS) due to tabs instead of spaces for stack trace indenting HOT 2
- pkg/dds/test/dap/integration/debug_exceptions_test went from flaky -> RuntimeError on unittest-asserts-release-win-arm64 HOT 4
- dartfuzz: crash during register allocation
- Assertion failure on iso-stress-linux HOT 1
- It is not currently possible to enable experiments for package dependencies in the analyzer HOT 9
- Assertion failure: Set::used_data not Smi during heap snapshot HOT 1
- Source location for StringConcatenation node for interpolation points to the end of the string. HOT 2
- How to identify lowerings for increment operations or find the source location correctly? HOT 1
- [ddc] Cleanup all support for unsound null safety
- Track the `ExtensionTypeElement` associated with constant `DartObject`s. HOT 1
- `dart2wasm`: Export constant identifying the compiler HOT 2
- readIntoSync/readAsBytes/readAsBytesSync all do not read the full file size HOT 2
- json macro throws when there is a colliding member
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 sdk.