-
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
Constructor differences in dartc compared to dart_bin and frogsh #360
Comments
This comment was originally written by drfibonacci@google.com Added Area-Compiler, Triaged labels. |
This comment was originally written by zundel@google.com Added Accepted label. |
This comment was originally written by zundel@google.com I created a separate bug for the VM http://code.google.com/p/dart/issues/detail?id=556 patch up at: |
This comment was originally written by zundel@google.com Turns out this example is invalid dart. froghs and the VM acceept the example above only because B is never instantiated. See issue #556: Comment 3 by project member gbracha@google.com, Today (5 hours ago) A final variable can only be assigned once, when it is initialized, or a compile-time error occurs. I may add this as an example to the spec. If this is accepted by any of our implementations, it's wrong. Set owner to zundel@google.com. |
This issue was originally filed by financeC...@gmail.com
What steps will reproduce the problem?
adam@ubuntu:~/dart_bleeding/dart$ ./tools/build.py -m debug --arch=ia32
adam@ubuntu:/tmp$ cat > ConstructorExample.dart << EOF
class A {
int a;
}
class B extends A {
B(this.a);
//B(a) {
// this.a = a;
//}
}
class ConstructorExample {
ConstructorExample() {
}
void run() {
print("run");
}
}
void main() {
new ConstructorExample().run();
}
EOF
adam@ubuntu:/tmp$ ~/dart_bleeding/dart/out/Debug_ia32/dart_bin ./ConstructorExample.dart
run
adam@ubuntu:/tmp$ ~/dart_bleeding/dart/out/Debug_ia32/dartc ./ConstructorExample.dart
ConstructorExample.dart/ConstructorExample.dart:6: Could not match parameter initializer 'this.a' with any field
5: class B extends A {
6: B(this.a);
Compilation failed with 1 problem.
adam@ubuntu:/tmp$ ~/dart_bleeding/dart/frog/frogsh ./ConstructorExample.dart
run
What is the expected output?
Expected all commands to exit successfully.
What do you see instead?
The dartc exits with error when it reaches the constructor of a class that tries to set a field in the parent class.
What version of the product are you using?
adam@ubuntu:~/dart_bleeding/dart$ svn info
Path: .
URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart
Repository Root: http://dart.googlecode.com/svn
Repository UUID: 260f80e4-7a28-3924-810f-c04153c831b5
Revision: 1235
Node Kind: directory
Schedule: normal
Last Changed Author: jimhug@google.com
Last Changed Rev: 1235
Last Changed Date: 2011-11-05 12:40:45 -0700 (Sat, 05 Nov 2011)
On what operating system?
adam@ubuntu:~/dart_bleeding/dart$ uname -a
Linux ubuntu 2.6.38-11-generic #50-Ubuntu SMP Mon Sep 12 21:18:14 UTC 2011 i686 i686 i386 GNU/Linux
Adams-MacBook-Air:~ adam$ uname -a
Darwin Adams-MacBook-Air.local 11.2.0 Darwin Kernel Version 11.2.0: Tue Aug 9 20:54:00 PDT 2011; root:xnu-1699.24.8~1/RELEASE_X86_64 x86_64
Please provide any additional information below.
Noticed this difference when using the dart editor. The dart editor seems to let auto complete resolve the field. When auto-compile triggers the error is reported in the dart editor.
The text was updated successfully, but these errors were encountered: