Skip to content

Commit 5dc232a

Browse files
authored
Merge pull request #7806 from dotty-staging/move-files-4
Move files after -sourcepath fix, fix sbt-dotty retrieval of dotty
2 parents 589d6ae + 4c008f9 commit 5dc232a

File tree

11 files changed

+27
-73
lines changed

11 files changed

+27
-73
lines changed

library/src-bootstrapped/scala/quoted/package.scala

Lines changed: 0 additions & 9 deletions
This file was deleted.

library/src-non-bootstrapped/scala/tasty/reflect/TreeUtils.scala

Lines changed: 0 additions & 56 deletions
This file was deleted.

project/Build.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ object Build {
753753
// Settings shared between dotty-library and dotty-library-bootstrapped
754754
lazy val dottyLibrarySettings = Seq(
755755
// Needed so that the library sources are visible when `dotty.tools.dotc.core.Definitions#init` is called
756-
scalacOptions in Compile ++= Seq("-sourcepath", (scalaSource in Compile).value.getAbsolutePath),
756+
scalacOptions in Compile ++= Seq("-sourcepath", (sourceDirectories in Compile).value.map(_.getAbsolutePath).distinct.mkString(File.pathSeparator)),
757757
)
758758

759759
lazy val `dotty-library` = project.in(file("library")).asDottyLibrary(NonBootstrapped)

sbt-dotty/src/dotty/tools/sbtplugin/DottyPlugin.scala

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,10 +404,15 @@ object DottyPlugin extends AutoPlugin {
404404

405405
/** Create a scalaInstance task that uses Dotty based on `moduleName`. */
406406
def dottyScalaInstanceTask(moduleName: String): Initialize[Task[ScalaInstance]] = Def.task {
407+
val ivyConfig0 = mkIvyConfiguration.value
408+
// When compiling non-bootstrapped projects in the build of Dotty itself,
409+
// dependency resolution might pick a local project which is not what we
410+
// want. We avoid this by dropping the inter-project resolver.
411+
val ivyConfig1 = ivyConfig0.withResolvers(ivyConfig0.resolvers.filter(_.name != "inter-project"))
407412
val updateReport =
408413
fetchArtifactsOf(
409414
scalaOrganization.value %% moduleName % scalaVersion.value,
410-
dependencyResolution.value,
415+
ivy.IvyDependencyResolution(ivyConfig1),
411416
scalaModuleInfo.value,
412417
updateConfiguration.value,
413418
(unresolvedWarningConfiguration in update).value,
@@ -431,6 +436,25 @@ object DottyPlugin extends AutoPlugin {
431436
)
432437
}
433438

439+
// Copy-pasted from sbt until we upgrade to a version of sbt
440+
// with https://github.com/sbt/sbt/pull/5271 in.
441+
def mkIvyConfiguration: Initialize[Task[InlineIvyConfiguration]] =
442+
Def.task {
443+
val (rs, other) = (fullResolvers.value.toVector, otherResolvers.value.toVector)
444+
val s = streams.value
445+
Classpaths.warnResolversConflict(rs ++: other, s.log)
446+
InlineIvyConfiguration()
447+
.withPaths(ivyPaths.value)
448+
.withResolvers(rs)
449+
.withOtherResolvers(other)
450+
.withModuleConfigurations(moduleConfigurations.value.toVector)
451+
.withLock(Defaults.lock(appConfiguration.value))
452+
.withChecksums((checksums in update).value.toVector)
453+
.withResolutionCacheDir(crossTarget.value / "resolution-cache")
454+
.withUpdateOptions(updateOptions.value)
455+
.withLog(s.log)
456+
}
457+
434458
def makeScalaInstance(
435459
state: State, dottyVersion: String, scalaLibrary: File, dottyLibrary: File, compiler: File, all: Seq[File]
436460
): ScalaInstance = {

tests/neg/i6762.check

Lines changed: 0 additions & 5 deletions
This file was deleted.

tests/neg/i6762.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ import scala.quoted.{_, given}
22

33
type G[X]
44
case class Foo[T](x: T)
5-
def f(word: String)(given QuoteContext): Expr[Foo[G[String]]] = '{Foo(${word.toExpr})} // error
5+
def f(word: String)(given QuoteContext): Expr[Foo[G[String]]] = '{Foo(${Expr(word)})} // error // error

0 commit comments

Comments
 (0)