From 353a4d9f17b91d09dea3c9090c7a21e267372abe Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Sat, 4 Mar 2017 17:27:10 +0100 Subject: Drop named type parameters in classes Drop the [type T] syntax, and what's associated to make it work. Motivation: It's an alternative way of doing things for which there seems to be little need. The implementation was provisional and bitrotted during the various iterations to introduce higher-kinded types. So in the end the complxity-cost for language and compiler was not worth the added benefit that [type T] parameters provide. Noe that we still accept _named arguments_ [A = T] in expressions; these are useful for specifying some parameters and letting others be inferred. --- tests/neg/namedTypeParams.scala | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 tests/neg/namedTypeParams.scala (limited to 'tests/neg/namedTypeParams.scala') diff --git a/tests/neg/namedTypeParams.scala b/tests/neg/namedTypeParams.scala new file mode 100644 index 000000000..75bb1cd7e --- /dev/null +++ b/tests/neg/namedTypeParams.scala @@ -0,0 +1,12 @@ +class C[T] +class D[type T] // error: identifier expected, but `type` found + +object Test { + + val x: C[T = Int] = // error: ']' expected, but `=` found // error + new C[T = Int] // error: ']' expected, but `=` found // error + + class E extends C[T = Int] // error: ']' expected, but `=` found // error + class F extends C[T = Int]() // error: ']' expected, but `=` found // error + +} -- cgit v1.2.3