-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix #12241: Make space computation lazy #12271
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
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
359b83e
Add test
liufengyun 48b6b56
Fix #12241: Make space computation lazy
liufengyun 29dbb82
Only compute `null` warning for small problems
liufengyun bb6c961
Add i12241 to benchmarks
liufengyun b5ce7fe
Add missing check file
liufengyun 1bc354e
Code refactoring
liufengyun 16a622f
Fix bootstrapping
liufengyun File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
abstract class Tree[-T >: Null] | ||
|
||
case class TypeTree[-T >: Null]() extends Tree[T] | ||
|
||
abstract class DerivedTypeTree() extends TypeTree[Null] | ||
|
||
def foo(tree: Tree[Null]): Unit = | ||
tree match | ||
case _: DerivedTypeTree => | ||
case TypeTree() => | ||
case _ => |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
54: Pattern Match Exhaustivity: (EndpointInput.Empty(), _), (EndpointInput.Pair(), EndpointInput.MappedPair()), (EndpointInput.Pair(), EndpointInput.Pair2()), (EndpointInput.Pair(), EndpointInput.MappedPair2()), (EndpointInput.Pair(), EndpointInput.FixedMethod()), (EndpointInput.Pair(), EndpointInput.FixedPath()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
sealed trait EndpointInput[T] | ||
|
||
object EndpointInput { | ||
case class Pair[T]() extends EndpointInput[T] | ||
case class MappedPair[T]() extends EndpointInput[T] | ||
case class Pair2[T]() extends EndpointInput[T] | ||
case class MappedPair2[T]() extends EndpointInput[T] | ||
case class FixedMethod[T]() extends EndpointInput[T] | ||
case class FixedPath[T]() extends EndpointInput[T] | ||
case class PathCapture[T]() extends EndpointInput[T] | ||
case class PathsCapture[T]() extends EndpointInput[T] | ||
case class Query[T]() extends EndpointInput[T] | ||
case class QueryParams[T]() extends EndpointInput[T] | ||
case class Cookie[T]() extends EndpointInput[T] | ||
case class ExtractFromRequest[T]() extends EndpointInput[T] | ||
case class ApiKey[T]() extends EndpointInput[T] | ||
case class Http[T]() extends EndpointInput[T] | ||
case class Body[R, T]() extends EndpointInput[T] | ||
case class FixedHeader[T]() extends EndpointInput[T] | ||
case class Header[T]() extends EndpointInput[T] | ||
case class Headers[T]() extends EndpointInput[T] | ||
case class StatusCode[T]() extends EndpointInput[T] | ||
case class Empty[T]() extends EndpointInput[T] | ||
} | ||
|
||
object Test extends App { | ||
import EndpointInput._ | ||
|
||
def compare(left: EndpointInput[_], right: EndpointInput[_]): Boolean = | ||
(left, right) match { | ||
case (Pair(), Pair()) => true | ||
case (MappedPair(), MappedPair()) => true | ||
case (Pair2(), Pair2()) => true | ||
case (MappedPair2(), MappedPair2()) => true | ||
case (FixedMethod(), FixedMethod()) => true | ||
case (FixedPath(), FixedPath()) => true | ||
case (PathCapture(), PathCapture()) => true | ||
case (PathsCapture(), PathsCapture()) => true | ||
case (Query(), Query()) => true | ||
case (QueryParams(), QueryParams()) => true | ||
case (Cookie(), Cookie()) => true | ||
case (ExtractFromRequest(), ExtractFromRequest()) => true | ||
case (ApiKey(), ApiKey()) => true | ||
case (Http(), Http()) => true | ||
case (Body(), Body()) => true | ||
case (FixedHeader(), FixedHeader()) => true | ||
case (Header(), Header()) => true | ||
case (Headers(), Headers()) => true | ||
case (StatusCode(), StatusCode()) => true | ||
case (_, _) => false | ||
} | ||
|
||
def compare2(left: EndpointInput[_], right: EndpointInput[_]): Boolean = | ||
(left, right) match { | ||
case (Pair(), Pair()) => true | ||
case (MappedPair(), MappedPair()) => true | ||
case (Pair2(), Pair2()) => true | ||
case (MappedPair2(), MappedPair2()) => true | ||
case (FixedMethod(), FixedMethod()) => true | ||
case (FixedPath(), FixedPath()) => true | ||
case (PathCapture(), PathCapture()) => true | ||
case (PathsCapture(), PathsCapture()) => true | ||
case (Query(), Query()) => true | ||
case (QueryParams(), QueryParams()) => true | ||
case (Cookie(), Cookie()) => true | ||
case (ExtractFromRequest(), ExtractFromRequest()) => true | ||
case (ApiKey(), ApiKey()) => true | ||
case (Http(), Http()) => true | ||
case (Body(), Body()) => true | ||
case (FixedHeader(), FixedHeader()) => true | ||
case (Header(), Header()) => true | ||
case (Headers(), Headers()) => true | ||
case (StatusCode(), StatusCode()) => true | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
26: Pattern Match Exhaustivity: (true, _: String, _), (true, _: Double, _), (true, true, _), (true, false, _), (true, (), _), (false, _: String, _) | ||
26: Pattern Match Exhaustivity: (true, _, _), (false, _, _), ((), _, _), (true, _: Double, _), (true, true, _) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
2: Pattern Match Exhaustivity: (List(_, _, _*), List(_, _*)), (Nil, List(_, _*)), (List(_, _*), List(_, _, _*)), (List(_, _*), Nil) | ||
2: Pattern Match Exhaustivity: (List(_, _, _*), List(_, _*)), (Nil, List(_, _*)), (List(_, _*), List(_, _, _*)), (List(_, _*), Nil), (_: List, List(_, _, _*)) | ||
11: Pattern Match Exhaustivity: (Foo(None), Foo(_)) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it would help performance if we do not compute
spaces.filter(_ ne sp)
eagerly.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here
spaces
has a size < 10, so should not matter much.