Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

More accurate outer checks in patterns#9504

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

@dwijnand
Copy link
Member

@dwijnanddwijnand commentedFeb 16, 2021
edited by lrytz
Loading

Avoids eliding outer checks that matter (run/t11534b.scala) and
avoids emitting checks that don't (pos/t11534.scala) which avoids
compiler warnings when the tested class doesn't have an outer
field.

The latter stops the annoying unchecked warning that appeared since
a recent refactoring made TermName a final class.

Originally submitted to 2.12.x as#8261.

Fixesscala/bug#11534

@scala-jenkinsscala-jenkins added this to the2.13.6 milestoneFeb 16, 2021
@dwijnanddwijnand modified the milestones:2.13.6,2.13.5Feb 16, 2021
@dwijnanddwijnandforce-pushed the2.13/more-accurate-outer-checks-in-patterns branch from67e77b9 to5fff7dcCompareFebruary 17, 2021 09:10
@SethTisue

This comment has been minimized.

@lrytz

This comment has been minimized.

@lrytzlrytz self-requested a reviewFebruary 18, 2021 15:38
@dwijnand

This comment has been minimized.

@SethTisue
Copy link
Member

@lrytz this is the last open ticket or PR for 2.13.5, but it takes time to run the community build.
in the interest of not delaying the release past (hopefully) Tuesday, do you consider this basically safe for merge? if so, can we merge it, so we have a release candidate for the community build? then you could continue reviewing it, meanwhile, and see whether any followup PR (either pre-2.13.5 or post-2.13.5) is needed.

@retronym
Copy link
Member

I'm happy to leave this until post-2.13.5

SethTisue reacted with thumbs up emoji

@dwijnand
Copy link
MemberAuthor

Agreed, this doesn't look ready to me:

testedBinder.info <:< expectedTp: falseexpectedTp: Test1.g.TermNamepre: Test1.g.typetestedBinder: value x1testedBinder.info: sym.NameTypetestedBinderClass: type NameTypetestedBinderType: sym.NameTypetestedBinderType.prefix: sym.typetestedPrefixIsExpectedTypePrefix: falsebaseTypeFromFreshPrefix: <notype>testedPrefixAndExpectedPrefixAreStaticallyIdentical: falseprefixAligns: false

@dwijnanddwijnand marked this pull request as draftFebruary 18, 2021 22:31
@dwijnanddwijnand modified the milestones:2.13.5,2.11.13,2.13.6Feb 18, 2021
@dwijnanddwijnandforce-pushed the2.13/more-accurate-outer-checks-in-patterns branch from5fff7dc to670f5c7CompareFebruary 18, 2021 22:32
@dwijnanddwijnand changed the title[fport] More accurate outer checks in patternsMore accurate outer checks in patternsFeb 22, 2021
@dwijnanddwijnandforce-pushed the2.13/more-accurate-outer-checks-in-patterns branch from5bf0524 to6a26cf3CompareFebruary 22, 2021 08:11
caseTypeRef(pre, _, _)if!pre.isStable=>// e.g. _: Outer#Inner
false
caseTypeRef(pre, sym, args)=>
valtestedBinderClass= testedBinder.info.upperBound.typeSymbol
Copy link
Member

Choose a reason for hiding this comment

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

This also works. Maybe slightly clearer than.upperBound.

diff --git a/src/compiler/scala/tools/nsc/transform/patmat/MatchTreeMaking.scala b/src/compiler/scala/tools/nsc/transform/patmat/MatchTreeMaking.scalaindex c62510e5b2..894fcd834a 100644--- a/src/compiler/scala/tools/nsc/transform/patmat/MatchTreeMaking.scala+++ b/src/compiler/scala/tools/nsc/transform/patmat/MatchTreeMaking.scala@@ -411,7 +411,7 @@ trait MatchTreeMaking extends MatchCodeGen with Debugging {                   case TypeRef(pre, _, _) if !pre.isStable => // e.g. _: Outer#Inner                     false                   case TypeRef(pre, sym, args) =>-                    val testedBinderClass = testedBinder.info.upperBound.typeSymbol+                    val testedBinderClass = testedBinder.info.baseClasses.find(_.isClass).getOrElse(NoSymbol)                     val testedBinderType = testedBinder.info.baseType(testedBinderClass)                     val testedPrefixIsExpectedTypePrefix = pre =:= testedBinderType.prefix

@dwijnanddwijnand marked this pull request as ready for reviewFebruary 24, 2021 13:37
@dwijnanddwijnandforce-pushed the2.13/more-accurate-outer-checks-in-patterns branch from6a26cf3 tocad94ffCompareMarch 8, 2021 20:55
@dwijnanddwijnand requested a review fromlrytzMarch 30, 2021 06:16
@SethTisueSethTisue added the release-notesworth highlighting in next release notes labelApr 8, 2021
Avoids eliding outer checks that matter (run/t11534b.scala) andavoids emitting checks that don't (pos/t11534.scala) which avoidscompiler warnings when the tested class doesn't have an outerfield.The latter stops the annoying unchecked warning that appeared sincea recent refactoring made `TermName` a final class.
@lrytzlrytzforce-pushed the2.13/more-accurate-outer-checks-in-patterns branch fromcad94ff to350bbe7CompareApril 20, 2021 13:47
Copy link
Member

@lrytzlrytz left a comment

Choose a reason for hiding this comment

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

Tricky stuff...!

@dwijnanddwijnand merged commit79ed5f8 intoscala:2.13.xApr 20, 2021
@dwijnanddwijnand deleted the 2.13/more-accurate-outer-checks-in-patterns branchApril 23, 2021 13:05
withOuterTest(withOuterTest(orig)(testedBinder, parent))(testedBinder, copyRefinedType(rt, rest, scope))
case expectedTp=>
valexpectedClass= expectedTp.typeSymbol
assert(!expectedClass.isRefinementClass, orig)
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

This failed, and I think it's because it's failing onxsbti.ScalaProvider with sbt.internal.inc.ScalaInstance.ScalaProvider2 @unchecked. Seescala/community-build#1400 (comment). I'm going to try to fix this, but work-stealers welcome.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@retronymretronymretronym left review comments

@lrytzlrytzlrytz approved these changes

Assignees

No one assigned

Labels

release-notesworth highlighting in next release notes

Projects

None yet

Milestone

2.13.6

Development

Successfully merging this pull request may close these issues.

Spurious "cannot be checked at runtime" in latest 2.12.x (regression wrt. 2.12.8)

5 participants

@dwijnand@SethTisue@lrytz@retronym@scala-jenkins

[8]ページ先頭

©2009-2025 Movatter.jp