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

Instantiation of type variable #7021

Closed
scheglov opened this issue Nov 29, 2012 · 6 comments
Closed

Instantiation of type variable #7021

scheglov opened this issue Nov 29, 2012 · 6 comments
Labels
area-test Cross-cutting test issues (use area- labels for specific failures; not used for package:test). P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@scheglov
Copy link
Contributor

language/instantiate_type_variable_negative_test
language/type_variable_static_context_negative_test

class Foo<T> {
  Foo() {}
  T make() { return new T(); }
}

Spec about type variables:
The type parameters of a generic declaration G are in scope in the bounds of all of the type parameters of G. The type parameters of a generic class declaration G are also in scope in the extends and implements clauses of G (if these exist) and in the body of G. However, a type parameter is considered to be a malformed type when referenced by a static member.

Spec about "new":
Let e be a new expression of the form new T.id(a1, .., an, xn+1: an+1, …, xn+k: an+k) or the form new T(a1, .., an, xn+1: an+1, …, xn+k: an+k). It is a static warning if T is not a class accessible in the current scope, optionally followed by type arguments.

So, these tests are not negative, they don't produce compile-time error.

@anders-sandholm
Copy link
Contributor

Removed this from the M2 milestone.
Added this to the M3 milestone.

@anders-sandholm
Copy link
Contributor

Removed this from the M3 milestone.
Added this to the M4 milestone.

@larsbak
Copy link

larsbak commented May 28, 2013

Removed this from the M4 milestone.
Added this to the M5 milestone.

@kasperl
Copy link

kasperl commented Jun 4, 2014

Removed this from the M5 milestone.
Added this to the 1.6 milestone.

@kasperl
Copy link

kasperl commented Jul 10, 2014

Removed this from the 1.6 milestone.
Added Oldschool-Milestone-1.6 label.

@kasperl
Copy link

kasperl commented Aug 4, 2014

Removed Oldschool-Milestone-1.6 label.

@scheglov scheglov added Type-Defect area-test Cross-cutting test issues (use area- labels for specific failures; not used for package:test). labels Aug 4, 2014
@kevmoo kevmoo added P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) and removed triaged labels Feb 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-test Cross-cutting test issues (use area- labels for specific failures; not used for package:test). P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

6 participants