Skip to content

Commit bf081d8

Browse files
committed
Merge remote-tracking branch 'origin/main' into sbt-1.1
2 parents b5af67c + 63849a0 commit bf081d8

File tree

103 files changed

+4550
-463
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+4550
-463
lines changed

.github/workflows/build-msi.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ on:
1414
workflow_call:
1515

1616
env:
17-
# NECESSARY FLAG TO CORRECTLY CONFIGURE THE VERSION FOR SCALA
18-
RELEASEBUILD: yes
17+
# Release only happends when triggering CI by pushing tag
18+
RELEASEBUILD: ${{ startsWith(github.event.ref, 'refs/tags/') && 'yes' || 'no' }}
1919

2020
jobs:
2121
build:

.github/workflows/ci.yaml

Lines changed: 64 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ jobs:
737737
- ${{ github.workspace }}/../../cache/sbt:/root/.sbt
738738
- ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache
739739
- ${{ github.workspace }}/../../cache/general:/root/.cache
740-
needs: [test_non_bootstrapped, test, mima, community_build_a, community_build_b, community_build_c, test_sbt, test_java8, build-sdk-package]
740+
needs: [test_non_bootstrapped, test, mima, community_build_a, community_build_b, community_build_c, test_sbt, test_java8, build-sdk-package, build-msi-package]
741741
if: "github.event_name == 'push'
742742
&& startsWith(github.event.ref, 'refs/tags/')"
743743

@@ -816,6 +816,18 @@ jobs:
816816
prepareSDK "-x86_64-apple-darwin" "dist-mac-x86_64" "./dist/mac-x86_64/"
817817
prepareSDK "-x86_64-pc-win32" "dist-win-x86_64" "./dist/win-x86_64/"
818818
819+
- name: Download MSI package
820+
uses: actions/download-artifact@v4
821+
with:
822+
name: scala.msi
823+
path: .
824+
- name: Prepare MSI package
825+
shell: bash
826+
run: |
827+
msiInstaller="scala3-${{ env.RELEASE_TAG }}.msi"
828+
mv scala.msi "${msiInstaller}"
829+
sha256sum "${msiInstaller}" > "${msiInstaller}.sha256"
830+
819831
# Create the GitHub release
820832
- name: Create GitHub Release
821833
id: create_gh_release
@@ -829,10 +841,10 @@ jobs:
829841
draft: true
830842
prerelease: ${{ contains(env.RELEASE_TAG, '-') }}
831843

832-
# The following steps are generated using template:
833-
# def template(distribution: String, suffix: String) =
834-
# def upload(kind: String, path: String, contentType: String) =
835-
# s"""- name: Upload $kind to GitHub Release ($distribution)
844+
# The following upload steps are generated using template:
845+
# val baseFileName = "scala3-${{ env.RELEASE_TAG }}"
846+
# def upload(kind: String, path: String, contentType: String, distribution: String) =
847+
# s"""- name: Upload $kind to GitHub Release ($distribution)
836848
# uses: actions/upload-release-asset@v1
837849
# env:
838850
# GITHUB_TOKEN: $${{ secrets.GITHUB_TOKEN }}
@@ -841,24 +853,33 @@ jobs:
841853
# asset_path: ./${path}
842854
# asset_name: ${path}
843855
# asset_content_type: ${contentType}"""
844-
# val filename = s"scala3-$${{ env.RELEASE_TAG }}${suffix}"
856+
# def uploadSDK(distribution: String, suffix: String) =
857+
# val filename = s"${baseFileName}${suffix}"
845858
# s"""
846859
# # $distribution
847-
# ${upload("zip archive", s"$filename.zip", "application/zip")}
848-
# ${upload("zip archive SHA", s"$filename.zip.sha256", "text/plain")}
849-
# ${upload("tar.gz archive", s"$filename.tar.gz", "application/gzip")}
850-
# ${upload("tar.gz archive SHA", s"$filename.tar.gz.sha256", "text/plain")}
860+
# ${upload("zip archive", s"$filename.zip", "application/zip", distribution)}
861+
# ${upload("zip archive SHA", s"$filename.zip.sha256", "text/plain", distribution)}
862+
# ${upload("tar.gz archive", s"$filename.tar.gz", "application/gzip", distribution)}
863+
# ${upload("tar.gz archive SHA", s"$filename.tar.gz.sha256", "text/plain", distribution)}
864+
# """
865+
# def uploadMSI() =
866+
# val distribution = "Windows x86_64 MSI"
867+
# s"""
868+
# # $distribution
869+
# ${upload(".msi file", s"${baseFileName}.msi", "application/x-msi", distribution)}
870+
# ${upload(".msi file SHA", s"${baseFileName}.msi.sha256", "text/plain", distribution)}
851871
# """
852-
853872
# @main def gen =
854873
# Seq(
855-
# template("Universal", ""),
856-
# template("Linux x86-64", "-x86_64-pc-linux"),
857-
# template("Linux aarch64", "-aarch64-pc-linux"),
858-
# template("Mac x86-64", "-x86_64-apple-darwin"),
859-
# template("Mac aarch64", "-aarch64-apple-darwin"),
860-
# template("Windows x86_64", "-x86_64-pc-win32")
874+
# uploadSDK("Universal", ""),
875+
# uploadSDK("Linux x86-64", "-x86_64-pc-linux"),
876+
# uploadSDK("Linux aarch64", "-aarch64-pc-linux"),
877+
# uploadSDK("Mac x86-64", "-x86_64-apple-darwin"),
878+
# uploadSDK("Mac aarch64", "-aarch64-apple-darwin"),
879+
# uploadSDK("Windows x86_64", "-x86_64-pc-win32"),
880+
# uploadMSI()
861881
# ).foreach(println)
882+
862883
# Universal
863884
- name: Upload zip archive to GitHub Release (Universal)
864885
uses: actions/upload-release-asset@v1
@@ -1092,8 +1113,29 @@ jobs:
10921113
asset_name: scala3-${{ env.RELEASE_TAG }}-x86_64-pc-win32.tar.gz.sha256
10931114
asset_content_type: text/plain
10941115

1116+
1117+
# Windows x86_64 MSI
1118+
- name: Upload .msi file to GitHub Release (Windows x86_64 MSI)
1119+
uses: actions/upload-release-asset@v1
1120+
env:
1121+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1122+
with:
1123+
upload_url: ${{ steps.create_gh_release.outputs.upload_url }}
1124+
asset_path: ./scala3-${{ env.RELEASE_TAG }}.msi
1125+
asset_name: scala3-${{ env.RELEASE_TAG }}.msi
1126+
asset_content_type: application/x-msi
1127+
- name: Upload .msi file SHA to GitHub Release (Windows x86_64 MSI)
1128+
uses: actions/upload-release-asset@v1
1129+
env:
1130+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1131+
with:
1132+
upload_url: ${{ steps.create_gh_release.outputs.upload_url }}
1133+
asset_path: ./scala3-${{ env.RELEASE_TAG }}.msi.sha256
1134+
asset_name: scala3-${{ env.RELEASE_TAG }}.msi.sha256
1135+
asset_content_type: text/plain
1136+
10951137
- name: Publish Release
1096-
run: ./project/scripts/sbtPublish ";project scala3-bootstrapped ;publishSigned ;sonatypeBundleRelease"
1138+
run: ./project/scripts/sbtPublish ";project scala3-bootstrapped ;publishSigned ;sonatypeBundleUpload"
10971139

10981140

10991141
open_issue_on_failure:
@@ -1118,14 +1160,16 @@ jobs:
11181160

11191161
build-msi-package:
11201162
uses: ./.github/workflows/build-msi.yml
1121-
if : github.event_name == 'pull_request' && contains(github.event.pull_request.body, '[test_msi]')
1163+
if :
1164+
(github.event_name == 'pull_request' && contains(github.event.pull_request.body, '[test_msi]')) ||
1165+
(github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/'))
11221166

11231167
test-msi-package:
11241168
uses: ./.github/workflows/test-msi.yml
11251169
needs: [build-msi-package]
11261170
with:
11271171
# Ensure that version starts with prefix 3.
1128-
# In the future it can be adapted to compare with with git tag or version set in the build.s
1172+
# In the future it can be adapted to compare with with git tag or version set in the project/Build.scala
11291173
version: "3."
11301174
java-version: 8
11311175

.github/workflows/publish-sdkman.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
- platform: WINDOWS_64
4747
archive : 'scala3-${{ inputs.version }}-x86_64-pc-win32.zip'
4848
steps:
49-
- uses: hamzaremmal/sdkman-release-action@1f2d4209b4f5a38721d4ae20014ea8e1689d869e
49+
- uses: sdkman/sdkman-release-action@1f2d4209b4f5a38721d4ae20014ea8e1689d869e
5050
with:
5151
CONSUMER-KEY : ${{ secrets.CONSUMER-KEY }}
5252
CONSUMER-TOKEN : ${{ secrets.CONSUMER-TOKEN }}
@@ -59,7 +59,7 @@ jobs:
5959
runs-on: ubuntu-latest
6060
needs: publish
6161
steps:
62-
- uses: hamzaremmal/sdkman-default-action@b3f991bd109e40155af1b13a4c6fc8e8ccada65e
62+
- uses: sdkman/sdkman-default-action@b3f991bd109e40155af1b13a4c6fc8e8ccada65e
6363
with:
6464
CONSUMER-KEY : ${{ secrets.CONSUMER-KEY }}
6565
CONSUMER-TOKEN : ${{ secrets.CONSUMER-TOKEN }}

compiler/src/dotty/tools/dotc/ast/TreeInfo.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,9 @@ trait TreeInfo[T <: Untyped] { self: Trees.Instance[T] =>
142142

143143
/** All term arguments of an application in a single flattened list */
144144
def allTermArguments(tree: Tree): List[Tree] = unsplice(tree) match {
145-
case Apply(fn, args) => allArguments(fn) ::: args
146-
case TypeApply(fn, args) => allArguments(fn)
147-
case Block(_, expr) => allArguments(expr)
145+
case Apply(fn, args) => allTermArguments(fn) ::: args
146+
case TypeApply(fn, args) => allTermArguments(fn)
147+
case Block(_, expr) => allTermArguments(expr)
148148
case _ => Nil
149149
}
150150

compiler/src/dotty/tools/dotc/ast/untpd.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -524,8 +524,8 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
524524
def makeRetaining(parent: Tree, refs: List[Tree], annotName: TypeName)(using Context): Annotated =
525525
Annotated(parent, New(scalaAnnotationDot(annotName), List(refs)))
526526

527-
def makeCapsOf(id: Ident)(using Context): Tree =
528-
TypeApply(Select(scalaDot(nme.caps), nme.capsOf), id :: Nil)
527+
def makeCapsOf(tp: RefTree)(using Context): Tree =
528+
TypeApply(Select(scalaDot(nme.caps), nme.capsOf), tp :: Nil)
529529

530530
def makeCapsBound()(using Context): Tree =
531531
makeRetaining(

compiler/src/dotty/tools/dotc/cc/CaptureOps.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ extension (tp: Type)
194194
true
195195
case tp: TermRef =>
196196
((tp.prefix eq NoPrefix)
197-
|| tp.symbol.is(ParamAccessor) && tp.prefix.isThisTypeOf(tp.symbol.owner)
197+
|| tp.symbol.isField && !tp.symbol.isStatic && tp.prefix.isTrackableRef
198198
|| tp.isRootCapability
199199
) && !tp.symbol.isOneOf(UnstableValueFlags)
200200
case tp: TypeRef =>

compiler/src/dotty/tools/dotc/cc/CaptureRef.scala

Lines changed: 40 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,19 @@ trait CaptureRef extends TypeProxy, ValueType:
6161
case tp: TermParamRef => tp.underlying.derivesFrom(defn.Caps_Exists)
6262
case _ => false
6363

64-
/** Normalize reference so that it can be compared with `eq` for equality */
65-
final def normalizedRef(using Context): CaptureRef = this match
66-
case tp @ AnnotatedType(parent: CaptureRef, annot) if tp.isTrackableRef =>
67-
tp.derivedAnnotatedType(parent.normalizedRef, annot)
68-
case tp: TermRef if tp.isTrackableRef =>
69-
tp.symbol.termRef
70-
case _ => this
64+
// With the support of pathes, we don't need to normalize the `TermRef`s anymore.
65+
// /** Normalize reference so that it can be compared with `eq` for equality */
66+
// final def normalizedRef(using Context): CaptureRef = this match
67+
// case tp @ AnnotatedType(parent: CaptureRef, annot) if tp.isTrackableRef =>
68+
// tp.derivedAnnotatedType(parent.normalizedRef, annot)
69+
// case tp: TermRef if tp.isTrackableRef =>
70+
// tp.symbol.termRef
71+
// case _ => this
7172

7273
/** The capture set consisting of exactly this reference */
7374
final def singletonCaptureSet(using Context): CaptureSet.Const =
7475
if mySingletonCaptureSet == null then
75-
mySingletonCaptureSet = CaptureSet(this.normalizedRef)
76+
mySingletonCaptureSet = CaptureSet(this)
7677
mySingletonCaptureSet.uncheckedNN
7778

7879
/** The capture set of the type underlying this reference */
@@ -97,27 +98,51 @@ trait CaptureRef extends TypeProxy, ValueType:
9798
* x subsumes y ==> x* subsumes y, x subsumes y?
9899
* x subsumes y ==> x* subsumes y*, x? subsumes y?
99100
* x: x1.type /\ x1 subsumes y ==> x subsumes y
101+
* TODO: Document path cases
100102
*/
101103
final def subsumes(y: CaptureRef)(using Context): Boolean =
104+
105+
def subsumingRefs(x: Type, y: Type): Boolean = x match
106+
case x: CaptureRef => y match
107+
case y: CaptureRef => x.subsumes(y)
108+
case _ => false
109+
case _ => false
110+
111+
def viaInfo(info: Type)(test: Type => Boolean): Boolean = info.match
112+
case info: SingletonCaptureRef => test(info)
113+
case info: AndType => viaInfo(info.tp1)(test) || viaInfo(info.tp2)(test)
114+
case info: OrType => viaInfo(info.tp1)(test) && viaInfo(info.tp2)(test)
115+
case _ => false
116+
102117
(this eq y)
103118
|| this.isRootCapability
104119
|| y.match
105120
case y: TermRef =>
106-
(y.prefix eq this)
107-
|| y.info.match
108-
case y1: SingletonCaptureRef => this.subsumes(y1)
121+
y.prefix.match
122+
case ypre: CaptureRef =>
123+
this.subsumes(ypre)
124+
|| this.match
125+
case x @ TermRef(xpre: CaptureRef, _) if x.symbol == y.symbol =>
126+
// To show `{x.f} <:< {y.f}`, it is important to prove `x` and `y`
127+
// are equvalent, which means `x =:= y` in terms of subtyping,
128+
// not just `{x} =:= {y}` in terms of subcapturing.
129+
// It is possible to construct two singleton types `x` and `y`,
130+
// which subsume each other, but are not equal references.
131+
// See `tests/neg-custom-args/captures/path-prefix.scala` for example.
132+
withMode(Mode.IgnoreCaptures) {TypeComparer.isSameRef(xpre, ypre)}
133+
case _ =>
134+
false
109135
case _ => false
136+
|| viaInfo(y.info)(subsumingRefs(this, _))
110137
case MaybeCapability(y1) => this.stripMaybe.subsumes(y1)
111138
case _ => false
112139
|| this.match
113140
case ReachCapability(x1) => x1.subsumes(y.stripReach)
114-
case x: TermRef =>
115-
x.info match
116-
case x1: SingletonCaptureRef => x1.subsumes(y)
117-
case _ => false
141+
case x: TermRef => viaInfo(x.info)(subsumingRefs(_, y))
118142
case x: TermParamRef => subsumesExistentially(x, y)
119143
case x: TypeRef => assumedContainsOf(x).contains(y)
120144
case _ => false
145+
end subsumes
121146

122147
def assumedContainsOf(x: TypeRef)(using Context): SimpleIdentitySet[CaptureRef] =
123148
CaptureSet.assumedContains.getOrElse(x, SimpleIdentitySet.empty)

compiler/src/dotty/tools/dotc/cc/CaptureSet.scala

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ object CaptureSet:
374374

375375
def apply(elems: CaptureRef*)(using Context): CaptureSet.Const =
376376
if elems.isEmpty then empty
377-
else Const(SimpleIdentitySet(elems.map(_.normalizedRef.ensuring(_.isTrackableRef))*))
377+
else Const(SimpleIdentitySet(elems.map(_.ensuring(_.isTrackableRef))*))
378378

379379
def apply(elems: Refs)(using Context): CaptureSet.Const =
380380
if elems.isEmpty then empty else Const(elems)
@@ -508,7 +508,11 @@ object CaptureSet:
508508
!noUniversal
509509
else elem match
510510
case elem: TermRef if level.isDefined =>
511-
elem.symbol.ccLevel <= level
511+
elem.prefix match
512+
case prefix: CaptureRef =>
513+
levelOK(prefix)
514+
case _ =>
515+
elem.symbol.ccLevel <= level
512516
case elem: ThisType if level.isDefined =>
513517
elem.cls.ccLevel.nextInner <= level
514518
case ReachCapability(elem1) =>

0 commit comments

Comments
 (0)