-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Refactor the abstract domain of global init checker to compile http4s #22179
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
10 commits
Select commit
Hold shift + click to select a range
637a5f6
Refactor pattern matching, skipping cases when safe to do so
7db959e
Add BaseOrUnknownValue
44ed0b3
Refactor abstract domain; combining Cold and Unknown Value; adding Pa…
bf18e95
Add option to ignore using unknown value warning
f51f91b
Rename BaseValue to SafeValue
fdcb455
Adding semantics for calling on SafeValue and evaluating SeqLiteral
7ee0726
Modify test
6b5d6a4
Address comments; add TopWidenedValue
e72efed
Reorganize tests
773880f
Address comments
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
386 changes: 288 additions & 98 deletions
386
compiler/src/dotty/tools/dotc/transform/init/Objects.scala
Large diffs are not rendered by default.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
compiler/test/dotc/neg-init-global-scala2-library-tasty.excludelist
This file contains 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 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
File renamed without changes.
This file contains 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,5 @@ | ||
object A: | ||
val a = f(10) | ||
val b = -a | ||
val c = b.toDouble | ||
def f(x: Int) = x * 2 + 5 |
16 changes: 16 additions & 0 deletions
16
tests/init-global/pos/packageObjectStringInterpolator.scala
This file contains 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,16 @@ | ||
package p | ||
package object a { | ||
val b = 10 | ||
implicit class CI(s: StringContext) { | ||
def ci(args: Any*) = 10 | ||
} | ||
} | ||
|
||
import p.a._ | ||
|
||
object A: | ||
val f = b // p.a(ObjectRef(p.a)).b | ||
def foo(s: String): String = s | ||
val f1 = ci"a" // => p.a(Package(p).select(a)).CI(StringContext"a").ci() | ||
|
||
|
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...global/warn/unapplySeq-implicit-arg.check → .../warn-tasty/unapplySeq-implicit-arg.check
This file contains 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
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...lobal/warn/unapplySeq-implicit-arg2.check → ...warn-tasty/unapplySeq-implicit-arg2.check
This file contains 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
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...lobal/warn/unapplySeq-implicit-arg3.check → ...warn-tasty/unapplySeq-implicit-arg3.check
This file contains 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
File renamed without changes.
This file contains 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 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 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,20 @@ | ||
-- Warning: tests/init-global/warn/widen.scala:13:13 ------------------------------------------------------------------- | ||
13 | t.foo() // warn | ||
| ^^^^^^^ | ||
| Value is unknown to the checker due to widening. Calling trace: | ||
| ├── object O: [ widen.scala:9 ] | ||
| │ ^ | ||
| ├── val a = bar(new C) [ widen.scala:20 ] | ||
| │ ^^^^^^^^^^ | ||
| ├── def bar(t: T) = { [ widen.scala:10 ] | ||
| │ ^ | ||
| ├── new A [ widen.scala:18 ] | ||
| │ ^^^^^ | ||
| ├── class A { [ widen.scala:11 ] | ||
| │ ^ | ||
| ├── val b = new B [ widen.scala:16 ] | ||
| │ ^^^^^ | ||
| ├── class B { [ widen.scala:12 ] | ||
| │ ^ | ||
| └── t.foo() // warn [ widen.scala:13 ] | ||
| ^^^^^^^ |
This file contains 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,20 @@ | ||
trait T { | ||
def foo(): Unit | ||
} | ||
|
||
class C extends T { | ||
def foo(): Unit = println("Calling foo on an instance of C!") | ||
} | ||
|
||
object O: | ||
def bar(t: T) = { | ||
class A { | ||
class B { | ||
t.foo() // warn | ||
} | ||
|
||
val b = new B | ||
} | ||
new A | ||
} | ||
val a = bar(new C) |
Oops, something went wrong.
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.
Our goal is to move all tests shown here to warn-tasty since they rely on tasty, but they also trigger some warnings in scala2 library which is hard to document