Skip to content

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
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

HarrisL2
Copy link
Contributor

A fixed version of #22473

This PR wraps the types of symbols from files compiled without explicit nulls in flexible types.
This allows for interop between multiple files in cases where

class Unsafe_1 {
  def foo(s: String): String = {
    if (s == null) then "nullString"
    else s
  }
}

compiled without explicit nulls can still be used in

def Flexible_2() =
  val s2: String | Null = "foo"
  val unsafe = new Unsafe_1()
  val s: String = unsafe.foo(s2)
  unsafe.foo("")
  unsafe.foo(null)

whereas the argument would have been a strictly non-null String, because of the flexible type, the function call is now permitted.

@olhotak olhotak requested a review from noti0na1 June 17, 2025 22:48
@olhotak
Copy link
Contributor

olhotak commented Jun 18, 2025

Test performance please

@olhotak
Copy link
Contributor

olhotak commented Jun 18, 2025

[test_scala2_library_tasty]

@noti0na1
Copy link
Member

test performance please

Copy link
Contributor

@olhotak olhotak left a comment

Choose a reason for hiding this comment

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

Please add a commit that doesn't change anything real to force the CI to re-run. (Perhaps change the newly-introduced double newline in TreeUnpickler.)

Otherwise LGTM, but also wait for approval from @noti0na1 .

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