File tree Expand file tree Collapse file tree 4 files changed +31
-15
lines changed Expand file tree Collapse file tree 4 files changed +31
-15
lines changed Original file line number Diff line number Diff line change @@ -98,9 +98,8 @@ object Config {
9898 final val splitProjections = false
9999
100100 /** If this flag is on, always rewrite an application `S[Ts]` where `S` is an alias for
101- * `[Xs] -> U` to `[Xs := Ts]U`. If this flag is off, the rewriting is only done if `S` is a
102- * reference to an instantiated parameter. Turning this flag on was observed to
103- * give a ~6% speedup on the JUnit test suite.
101+ * `[Xs] -> U` to `[Xs := Ts]U`.
102+ * Turning this flag on was observed to give a ~6% speedup on the JUnit test suite.
104103 */
105104 final val simplifyApplications = true
106105
Original file line number Diff line number Diff line change @@ -470,18 +470,13 @@ class TypeApplications(val self: Type) extends AnyVal {
470470 case dealiased : TypeLambda =>
471471 def tryReduce =
472472 if (! args.exists(_.isInstanceOf [TypeBounds ])) {
473- val followAlias = stripped match {
474- case stripped : TypeRef =>
475- stripped.symbol.is(BaseTypeArg )
476- case _ =>
477- Config .simplifyApplications && {
478- dealiased.resType match {
479- case AppliedType (tyconBody, _) =>
480- variancesConform(typParams, tyconBody.typeParams)
481- // Reducing is safe for type inference, as kind of type constructor does not change
482- case _ => false
483- }
484- }
473+ val followAlias = Config .simplifyApplications && {
474+ dealiased.resType match {
475+ case AppliedType (tyconBody, _) =>
476+ variancesConform(typParams, tyconBody.typeParams)
477+ // Reducing is safe for type inference, as kind of type constructor does not change
478+ case _ => false
479+ }
485480 }
486481 if ((dealiased eq stripped) || followAlias) dealiased.instantiate(args)
487482 else HKApply (self, args)
Original file line number Diff line number Diff line change 1+ class Foo [A ]
2+
3+ object Test {
4+ def foo [M [_,_]](x : M [Int ,Int ]) = x
5+
6+ type Alias [X ,Y ] = Foo [X ]
7+ val x : Alias [Int ,Int ] = new Foo [Int ]
8+
9+ foo[Alias ](x) // ok
10+ foo(x)
11+ }
Original file line number Diff line number Diff line change 1+ class Foo [A ]
2+
3+ trait Bar [DD [_,_]] {
4+ val x : DD [Int , Int ]
5+ }
6+
7+ trait Baz extends Bar [[X ,Y ] -> Foo [X ]] {
8+ def foo [M [_,_]](x : M [Int , Int ]) = x
9+
10+ foo(x)
11+ }
You can’t perform that action at this time.
0 commit comments