Skip to content

Avoid most deep subtypes in test #3272

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

Merged
merged 1 commit into from
Oct 6, 2017

Conversation

smarter
Copy link
Member

@smarter smarter commented Oct 5, 2017

The only remaining testcase requiring deep subtype is t8146a.scala for
good reasons.

@smarter smarter requested a review from odersky October 5, 2017 16:04
@smarter smarter force-pushed the fix-deep-subtypes branch 2 times, most recently from dc0a053 to bde360b Compare October 5, 2017 16:52
@smarter
Copy link
Member Author

smarter commented Oct 5, 2017

test performance please

@dottybot
Copy link
Member

dottybot commented Oct 5, 2017

performance test scheduled: 9 job(s) in queue, 1 running.

The only remaining testcase requiring deep subtype is t8146a.scala for
good reasons.
@smarter smarter force-pushed the fix-deep-subtypes branch from bde360b to eb2fdf2 Compare October 5, 2017 22:40
@dottybot
Copy link
Member

dottybot commented Oct 6, 2017

Performance test finished successfully:

Visit http://dotty-bench.epfl.ch/3272/ to see the changes.

Benchmarks is based on merging with master (af528a1)

Copy link
Contributor

@odersky odersky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! LGTM

// below never contain TypeRefs whose underling types contain
// uninstantiated TypeVars, this could lead to cycles in `isSubType`
// as a TypeVar might get constrained by a TypeRef it's part of.
val tp1a = fullyDefinedType(tp1, "alternative", alt1.symbol.pos).asInstanceOf[PolyType]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder whether we could optimize this so that we do the fullyDefinedType only if the type parameter bounds are non-trivial. fullyDefinedType is somewhat expensive.

@smarter smarter merged commit 7c8f557 into scala:master Oct 6, 2017
val tparams = ctx.newTypeParams(alt1.symbol, tp1.paramNames, EmptyFlags, tp1.instantiateBounds)
isAsSpecific(alt1, tp1.instantiate(tparams.map(_.typeRef)), alt2, tp2)
val nestedCtx = ctx.fresh.setExploreTyperState()

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we can use TyperState.test here/ It's cheaper and easier to use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants