-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Apply flexible types to files compiled without explicit nulls #23386
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
Open
HarrisL2
wants to merge
4
commits into
scala:main
Choose a base branch
from
HarrisL2:flexibleunpickle
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+155
−28
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
099bf33
Exclude some explicit nulls negs tests under tasty
HarrisL2 52d7b22
Do not flexify higher-kinded types
HarrisL2 3cdda29
Merge branch 'main' into flexibleunpickle
HarrisL2 d9f49d1
Only nullify tasty files if flexible types are enabled
HarrisL2 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
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
18 changes: 18 additions & 0 deletions
18
compiler/test/dotc/neg-explicit-nulls-scala2-library-tasty.excludelist
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,18 @@ | ||
byname-nullables.scala # identity() flexified | ||
varargs.scala # Array type flexified | ||
flow-conservative.scala # .length flexified | ||
nn-basic.scala # .length flexified but trim rejected | ||
i21380c.scala # .length flexified but replaceAll rejected | ||
unsafe-scope.scala # .length flexified | ||
i17467.scala # Singleton type flexified | ||
i7883.scala # Unsure | ||
from-nullable.scala # Option argument flexified | ||
flow-in-block.scala # .length flexified | ||
array.scala # Type arugment of Array flexified | ||
flow-forward-ref.scala # .length flexified, forward reference error | ||
flow-implicitly.scala # Singleton type flexified | ||
nn.scala # Flexified elided error [!] | ||
flow-basic.scala # .length flexified | ||
|
||
unsafe-cast.scala # Array type flexified | ||
unsafe-extensions.scala # Function arguments flexified |
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,38 @@ | ||
import unsafeNulls.Foo.* | ||
import unsafeNulls.Unsafe_1 | ||
|
||
class Inherit_1 extends Unsafe_1 { | ||
override def foo(s: String): String = s | ||
override def bar[T >: String](s: T): T = s | ||
override def bar2[T >: String | Null](s: T): T = s | ||
override def bar3[T <: Function1[String,String]](g: T) = g | ||
override def bar4[HK[_]](i: String | Null): HK[String | Null] = ??? | ||
} | ||
|
||
class Inherit_2 extends Unsafe_1 { | ||
override def foo(s: String | Null): String | Null = null | ||
override def bar[T >: String](s: T | Null): T | Null = s | ||
override def bar2[T >: String](s: T): T = s | ||
override def bar3[T <: Function1[(String|Null),(String|Null)]](g: T) = g | ||
override def bar4[HK[_]](i: String): HK[String] = ??? | ||
} | ||
|
||
class Inherit_3 extends Unsafe_1 { | ||
override def foo(s: String): String | Null = null | ||
override def bar[T >: String](s: T): T | Null = s | ||
} | ||
|
||
class Inherit_4 extends Unsafe_1 { | ||
override def foo(s: String | Null): String = "non-null string" | ||
override def bar[T >: String](s: T | Null): T = "non-null string" | ||
} | ||
|
||
case class cc() | ||
|
||
@main | ||
def Flexible_2() = | ||
val s2: String | Null = "foo" | ||
val unsafe = new Unsafe_1() | ||
val s: String = unsafe.foo(s2) | ||
unsafe.foo("") | ||
unsafe.foo(null) |
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,21 @@ | ||
package unsafeNulls | ||
|
||
class Unsafe_1 { | ||
def foo(s: String): String = { | ||
if (s == null) then "nullString" | ||
else s | ||
} | ||
def bar[T >: String](s: T): T = { | ||
??? | ||
} | ||
def bar2[T >: String | Null](s: T): T = { | ||
??? | ||
} | ||
def bar3[T <: Function1[String,String]](g: T): T = g | ||
def bar4[HK[_]](i: String): HK[String] = ??? | ||
} | ||
|
||
object Foo { | ||
def bar = "bar!" | ||
def id[T](t: T): T = t | ||
} |
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
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.
Uh oh!
There was an error while loading. Please reload this page.