Skip to content
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

Unspecified behavior of generics #987

Closed
DartBot opened this issue Dec 27, 2011 · 3 comments
Closed

Unspecified behavior of generics #987

DartBot opened this issue Dec 27, 2011 · 3 comments
Assignees
Labels
area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). closed-invalid Closed as we don't believe the reported issue is generally actionable

Comments

@DartBot
Copy link

DartBot commented Dec 27, 2011

This issue was originally filed by ms...@unipro.ru


In the section 9.Generics the specification states that "A type parameter T may be suffixed with an extends clause that specifies the upper bound for T." and "It is a static type warning if a type variable is supertype of its upper bound." But it does not explicitly specify behavior in case a type is not assignable to its upper bound.

Note, that test case
class A<T extends String> {}
main() {
  var x = new A<List>();
}
compiles and runs without errors in DartVM in scripting mode, produces compile-time error in DartVM in checked mode, produces compile-time error in dartc compiler in both modes and compiles without errors in frog in both modes.

@dgrove
Copy link
Contributor

dgrove commented Jan 2, 2012

Set owner to @gbracha.
Added Area-Language, Triaged labels.

@gbracha
Copy link
Contributor

gbracha commented Jan 3, 2012

  1. The declaration is perfectly valid. It can be instantiated as follows: A<String>.
  2. The usage should produce a static warning, per 10.10:

It is a static type warning if any of the type arguments to a constructor of a generic type G invoked by a new expression or a constant object expression are not subtypes of the bounds of the corresponding formal type parameters of G.

Hence the behavior of dartc is buggy.

If executed in checked mode, the usage should produce an error, per 10.10.1:

t is a dynamic type error if, in checked mode, Vi is not a subtype of [V1, ..., Vm/T1, ..., Tm]Bi, 1 <= i <= m.

 The VM behavior is therefore correct, and frog's checked-mode behavior is not.

Will open new bugs against dartc and frog.


Added Invalid label.

@gbracha
Copy link
Contributor

gbracha commented Jan 3, 2012

Just to clarify: "produces compile-time error in DartVM in checked mode," makes no sense, as checked mode has no effect on compilation. I assume it's a run time error.

Also: "compiles without errors in frog in both modes" is correct; the mode is irrelevant to compilation. If it runs without error in checked mode, there is a problem.

@DartBot DartBot added Type-Defect area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). closed-invalid Closed as we don't believe the reported issue is generally actionable labels Jan 3, 2012
dart-bot pushed a commit that referenced this issue Feb 22, 2021
2021-02-22 whesse@google.com Fix syntax error in test expectation in ffi test (#1002)
2021-02-20 irina.arkhipets@gmail.com #1000: Missing Issue tags added.
2021-02-20 irina.arkhipets@gmail.com Issue #1000: tests updated according to the recent result analysis
2021-02-20 sgrekhov@unipro.ru Roll failures fixed
2021-02-19 sgrekhov@unipro.ru #999. Missed experiment flags added
2021-02-19 sgrekhov@unipro.ru #993. 32 and 64-bit integer tests added
2021-02-19 sgrekhov@unipro.ru #993. Change test to expect compile error if struct subclass created by the constructor
2021-02-19 sgrekhov@unipro.ru #993. Remove tests that run "nm" command
2021-02-18 sgrekhov@unipro.ru #993. More ffi tests added
2021-02-18 irina.arkhipets@gmail.com Instantiate-to-bounds tests apdated according to the SDK Issues 44223, 42446 evaluation.
2021-02-17 irina.arkhipets@gmail.com Issue #535: nnbd-strong requirement added to the tests, more tests for constant evaluation and canonicalization added.
2021-02-17 sgrekhov@unipro.ru Some of type aliases tests fixed
2021-02-17 sgrekhov@unipro.ru #993. More Struct tests added
2021-02-16 irina.arkhipets@gmail.com Issue #535: more tests for constant evaluation and canonicalization added.
2021-02-12 irina.arkhipets@gmail.com Fixes #994: test expectesions updated according to the recent SDK changes.
2021-02-12 sgrekhov@unipro.ru #993. More Struct tests added
2021-02-12 irina.arkhipets@gmail.com Merge remote-tracking branch 'origin/master'
2021-02-12 sgrekhov@unipro.ru #993. NativeType and Struct tests added
2021-02-11 irina.arkhipets@gmail.com Fixes #991: tests updated according to the recent SDK changes.
2021-02-08 sgrekhov@unipro.ru #993. sizeOf() tests added
2021-02-05 sgrekhov@unipro.ru #993. More tests for DynamicLibrary added
2021-02-04 sgrekhov@unipro.ru #993. DynamicLibrary constructors tests added
2021-02-03 sgrekhov@unipro.ru #993. co19 ffi tests. Initial commit
2021-02-02 sgrekhov@unipro.ru Fixes #992. Boolean conditional evaluation tests added
2021-02-01 irina.arkhipets@gmail.com Fixes #990: tests updated according to the recent SDK changes.
2021-01-28 irina.arkhipets@gmail.com Fixes #979: I-2-b tests updated according to the recent changes for dart-lang/language#1133
2021-01-28 irina.arkhipets@gmail.com Fixes #984: I-2-b tests updated according to the recent changes for dart-lang/language#1133
2021-01-27 sgrekhov@unipro.ru Fixes #989. Runtime type equality operator tests added
2021-01-26 irina.arkhipets@gmail.com Fixes #988: Static warning checks corrected.
2021-01-25 sgrekhov@unipro.ru Fixes #987. Local variables and inference tests added

Cq-Include-Trybots: dart/try:analyzer-nnbd-linux-release-try,analyzer-nnbd-mac-release-try,analyzer-nnbd-win-release-try,dart2js-nnbd-linux-x64-chrome-try,ddc-nnbd-linux-release-chrome-try,front-end-nnbd-linux-release-x64-try,front-end-nnbd-mac-release-x64-try,front-end-nnbd-win-release-x64-try,vm-kernel-nnbd-linux-debug-ia32-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-nnbd-linux-release-ia32-try,vm-kernel-nnbd-linux-release-simarm-try,vm-kernel-nnbd-linux-release-simarm64-try,vm-kernel-nnbd-linux-release-x64-try,vm-kernel-nnbd-mac-debug-x64-try,vm-kernel-nnbd-mac-release-x64-try,vm-kernel-nnbd-win-debug-x64-try,vm-kernel-nnbd-win-release-ia32-try,vm-kernel-nnbd-win-release-x64-try,vm-kernel-precomp-nnbd-linux-debug-x64-try,vm-kernel-precomp-nnbd-linux-release-simarm64-try,vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-precomp-nnbd-mac-release-simarm64-try,vm-kernel-precomp-nnbd-win-release-x64-try
Change-Id: I78ba37f9c74d2afc360ef5fbd51d01ab75239fd6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186146
Reviewed-by: Jonas Termansen <sortie@google.com>
copybara-service bot pushed a commit that referenced this issue Jul 25, 2023
Revisions updated by `dart tools/rev_sdk_deps.dart`.

http (https://github.com/dart-lang/http/compare/b206771..1a42b4a):
  1a42b4a  2023-07-21  Brian Quinlan  Harmonize response header behavior (#993)
  db276f8  2023-07-21  Alex James  Java http send method (#987)

lints (https://github.com/dart-lang/lints/compare/e03dc04..1e0245e):
  1e0245e  2023-07-21  Parker Lougheed  Update tooling to use new `rules.json` location (#140)

mockito (https://github.com/dart-lang/mockito/compare/afa20a8..b421775):
  b421775  2023-07-22  Googler  Internal change

package_config (https://github.com/dart-lang/package_config/compare/be0c441..981c49d):
  981c49d  2023-07-21  Kevin Moore  Update to team lints, require Dart 3.0 (#139)

web_socket_channel (https://github.com/dart-lang/web_socket_channel/compare/7ae4d0f..4d1b543):
  4d1b543  2023-07-22  Jithuraj  Correction in Code Snippet (#275)

Change-Id: I0024ad558b128e9e2ba84f992e0d80fbb7bdc4cb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/315982
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). closed-invalid Closed as we don't believe the reported issue is generally actionable
Projects
None yet
Development

No branches or pull requests

3 participants