Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Build library under -Xsource:3 [ci: last-only] #10551

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

Draft
wants to merge 1 commit into
base: 2.13.x
Choose a base branch
from

Conversation

som-snytt
Copy link
Contributor

@som-snytt som-snytt commented Sep 20, 2023

Use -Xsource:3-cross, with the exclusion -Xsource-features:-case-companion-function in the library.

Stay on -Xsource:2.13 for scalap.

The hardest part was the overrides in Scaladoc's ModelFactory.

What worked like a charm is:

sbt:scala2> set ThisBuild / scalacOptions += "-quickfix:msg=lambda-parens"

Previously:

I will let mima complain. What is the mima command again?

I did a quick jardiff.

@scala-jenkins scala-jenkins added this to the 2.13.13 milestone Sep 20, 2023
@som-snytt som-snytt changed the title Build library under -Xsource:3 warnings Build library under -Xsource:3 warnings [ci: last-only] Sep 20, 2023
@som-snytt som-snytt force-pushed the trial/library-xsource3 branch from 05aa818 to dc042c5 Compare September 20, 2023 18:59
@som-snytt
Copy link
Contributor Author

I did not intend to ignore Deadline.

@lrytz
Copy link
Member

lrytz commented Sep 21, 2023

What is the mima command again?

library/mimaReportBinaryIssues

We might have to review if Xsource:3 has any semantic changes.

@xuwei-k
Copy link
Contributor

xuwei-k commented Sep 21, 2023

🤔

--- a/src/library/scala/concurrent/duration/Deadline.scala
+++ b/src/library/scala/concurrent/duration/Deadline.scala
@@ -65,6 +65,8 @@ case class Deadline private (time: FiniteDuration) extends Ordered[Deadline] {
    * The natural ordering for deadline is determined by the natural order of the underlying (finite) duration.
    */
   def compare(other: Deadline): Int = time compare other.time
+
+  def copy(time: FiniteDuration = this.time): Deadline = Deadline(time)
 }
 
 object Deadline {
@@ -82,4 +84,5 @@ object Deadline {
     def compare(a: Deadline, b: Deadline): Int = a compare b
   }
 
+  def apply(time: FiniteDuration): Deadline = new Deadline(time)

@xuwei-k
Copy link
Contributor

xuwei-k commented Sep 21, 2023

@som-snytt
Copy link
Contributor Author

@xuwei-k thanks, it is also a dry-run to test the pain caused by -Xsource:3.

@som-snytt
Copy link
Contributor Author

I was going to try out "improved ergonomics for -Xsource", but I think I will not do that here, as I want the Scala 3 semantics, so that there is never a question if an inferred type shows up differently for Scala 3.

@som-snytt
Copy link
Contributor Author

som-snytt commented Sep 28, 2023

Sample improved message

Deadline.scala:32:12: access modifiers for `apply` method are copied from the case class constructor

The private constructor is an ancient restriction; one may question that choice, but probably we must respect it for now.

The build needs to silence the old warnings for bootstrapping.

@som-snytt som-snytt force-pushed the trial/library-xsource3 branch 3 times, most recently from 28110b0 to a9ba237 Compare September 28, 2023 17:12
@som-snytt som-snytt marked this pull request as ready for review September 28, 2023 20:00
@som-snytt som-snytt marked this pull request as draft October 10, 2023 19:12
@som-snytt
Copy link
Contributor Author

Drafting until improved -Xsource:3 is merged.

@SethTisue SethTisue added the internal not resulting in user-visible changes (build changes, tests, internal cleanups) label Oct 13, 2023
@lrytz lrytz modified the milestones: 2.13.13, 2.13.14 Nov 28, 2023
@som-snytt
Copy link
Contributor Author

Ready to fork the project so I can merge #10573 and profit.

Closing until that is merged here.

@som-snytt som-snytt closed this Jan 16, 2024
@SethTisue SethTisue removed this from the 2.13.14 milestone Jan 16, 2024
@som-snytt som-snytt changed the title Build library under -Xsource:3 warnings [ci: last-only] [BLOCKED] Build library under -Xsource:3 warnings [ci: last-only] Jan 27, 2024
@som-snytt som-snytt changed the title [BLOCKED] Build library under -Xsource:3 warnings [ci: last-only] Build library under -Xsource:3 [ci: last-only] Apr 23, 2024
@som-snytt som-snytt reopened this Nov 19, 2024
@scala-jenkins scala-jenkins added this to the 2.13.16 milestone Nov 19, 2024
@som-snytt som-snytt force-pushed the trial/library-xsource3 branch 2 times, most recently from f6c0c59 to 898bb8f Compare November 19, 2024 03:51
@som-snytt som-snytt force-pushed the trial/library-xsource3 branch from 898bb8f to 844918a Compare November 19, 2024 10:11
@som-snytt
Copy link
Contributor Author

som-snytt commented Nov 19, 2024

[error] Conflicting compiler settings were detected. Some settings will be ignored.
[error] -Xsource-features requires -Xsource:3

Locally, on restarr publish

[error] ## Exception when compiling 164 sources to /home/amarki/projects/scala/build/quick/classes/reflect
[error] java.lang.NoClassDefFoundError: scala/collection/immutable/WrappedString
[error] scala.LowPriorityImplicits.wrapString(Predef.scala:578)
[error] scala.tools.xsbt.DelegatingReporter$.makePosition$1(DelegatingReporter.scala:141)
[error] scala.tools.xsbt.DelegatingReporter$.convert(DelegatingReporter.scala:190)
[error] scala.tools.xsbt.DelegatingReporter.doReport(DelegatingReporter.scala:225)
[error] scala.reflect.internal.Reporter.filteredInfo(Reporting.scala:126)
[error] scala.reflect.internal.Reporter.error(Reporting.scala:121)
[error] scala.tools.nsc.Reporting$PerRunReporting.error(Reporting.scala:391)
[error] scala.tools.nsc.typechecker.Contexts$ImmediateReporter.error(Contexts.scala:1821)

oh, maybe that never worked, publishLocal overwrites the local starr version.

@som-snytt
Copy link
Contributor Author

som-snytt commented Nov 19, 2024

sigs via scalap, from overridden toString you get java.lang.String

-  override val iter: scala.Iterator[scala.Char] = { /* compiled code */ } // BufferedSource
+  override val iter: scala.collection.Iterator[scala.Char] = { /* compiled code */ }
-  override def toString(): java.lang.String = { /* compiled code */ }
+  override def toString(): scala.Predef.String = { /* compiled code */ }
-    def set(newValue: scala.Predef.String): scala.Predef.String = { /* compiled code */ } // BooleanProp
+    def set(newValue: scala.Predef.String): java.lang.String = { /* compiled code */ }

@SethTisue SethTisue modified the milestones: 2.13.16, 2.13.17 Dec 12, 2024
@som-snytt som-snytt force-pushed the trial/library-xsource3 branch from 844918a to 230304c Compare April 10, 2025 04:47
@som-snytt
Copy link
Contributor Author

squashed rebase of local branch, which seems to have some debug settings. Maybe I was tracking down those optimizer warnings?

@som-snytt
Copy link
Contributor Author

som-snytt commented Apr 10, 2025

Weirdly,

// not inline due to outer pointer; optimizer warns on uninlined calls into tpd

but it incurs a warning anyway. I haven't looked at it yet; this was the first opt warning. Or, the def Apply is inline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal not resulting in user-visible changes (build changes, tests, internal cleanups)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants