Skip to content

Commit c4bafda

Browse files
committed
Merge remote-tracking branch 'dotty/master' into call-graph-wip-1
2 parents b56f7cf + 5093126 commit c4bafda

File tree

99 files changed

+1204
-801
lines changed

Some content is hidden

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

99 files changed

+1204
-801
lines changed

.drone.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ pipeline:
1111
image: lampepfl/dotty:24-04-2017
1212
pull: true
1313
commands:
14-
- ln -s /var/cache/drone/scala-scala scala-scala
1514
- ln -s /var/cache/drone/ivy2 "$HOME/.ivy2"
16-
- ./project/scripts/updateScalaLibrary
1715
- sbt -J-Xmx4096m -J-XX:ReservedCodeCacheSize=512m -J-XX:MaxMetaspaceSize=1024m -Ddotty.drone.mem=4096m "${CI_TEST}"
1816
when:
1917
branch:
@@ -42,5 +40,5 @@ matrix:
4240
CI_PUBLISH: false
4341
- CI_TEST: ;test;sbt-dotty/scripted
4442
CI_PUBLISH: false
45-
- CI_TEST: ;dotty-sbt-bridge/publishLocal ;dotty-bootstrapped/test
43+
- CI_TEST: dotty-bootstrapped/test
4644
CI_PUBLISH: false

.drone.yml.sig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
eyJhbGciOiJIUzI1NiJ9.IyBBZnRlciB1cGRhdGluZyB0aGlzIGZpbGUsIHlvdSBuZWVkIHRvIHJlLXNpZ24gaXQ6CiMKIyAtIEluc3RhbGwgW2Ryb25lLWNsaV0oaHR0cDovL3JlYWRtZS5kcm9uZS5pby91c2FnZS9nZXR0aW5nLXN0YXJ0ZWQtY2xpLykKIyAtIENvcHkgeW91ciB0b2tlbiBmcm9tICBodHRwOi8vZG90dHktY2kuZXBmbC5jaC9hY2NvdW50IChDbGljayBTSE9XIFRPS0VOKQojIC0gKGV4cG9ydCBEUk9ORV9UT0tFTj15b3VyLXRva2VuOyBleHBvcnQgRFJPTkVfU0VSVkVSPWh0d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1zIC92YXIvY2FjaGUvZHJvbmUvaXZ5MiAiJEhPTUUvLml2eTIiCiAgICAgIC0gc2J0IC1KLVhteDQwOTZtIC1KLVhYOlJlc2VydmVkQ29kZUNhY2hlU2l6ZT01MTJtIC1KLVhYOk1heE1ldGFzcGFjZVNpemU9MTAyNG0gLURkb3R0eS5kcm9uZS5tZW09NDA5Nm0gIiR7Q0lfVEVTVH0iCiAgICB3aGVuOgogICAgICBicmFuY2g6CiAgICAgICAgZXhjbHVkZTogZ2gtcGFnZXMKCiAgZG9jdW1lbnRhdGlvbjoKICAgIGltYWdlOiBsYW1wZXBmbC9kb3R0eToyNC0wNC0yMDE3CiAgICBwdWxsOiB0cnVlCiAgICBjb21tYW5kczoKICAgICAgLSAuL3Byb2plY3Qvc2NyaXB0cy9nZW5Eb2NzICIke0NJX1BVQkxJU0h9IiAkQk9UX1BBU1MKICAgIHdoZW46CiAgICAgIGJyYW5jaDogbWFzdGVyCgogIHNsYWNrOgogICAgaW1hZ2U6IHBsdWdpbnMvc2xhY2sKICAgIGNoYW5uZWw6IGRvdHR5CiAgICB3aGVuOgogICAgICBicmFuY2g6IG1hc3RlcgogICAgICBzdGF0dXM6IGNoYW5nZWQKCm1hdHJpeDoKICBpbmNsdWRlOgogICAgLSBDSV9URVNUOiBkb3R0eS1iaW4tdGVzdHMvdGVzdAogICAgICBDSV9QVUJMSVNIOiB0cnVlCiAgICAtIENJX1RFU1Q6IGxlZ2FjeVRlc3RzCiAgICAgIENJX1BVQkxJU0g6IGZhbHNlCiAgICAtIENJX1RFU1Q6IDt0ZXN0O3NidC1kb3R0eS9zY3JpcHRlZAogICAgICBDSV9QVUJMSVNIOiBmYWxzZQogICAgLSBDSV9URVNUOiBkb3R0eS1ib290c3RyYXBwZWQvdGVzdAogICAgICBDSV9QVUJMSVNIOiBmYWxzZQo.Ib2LCIvmphRVXRKdsgpf8MiRlNwZmtE7d0dRv7u_aMo

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@ tests/partest-generated/
4040
tests/locks/
4141
/test-classes/
4242

43-
# Used in tests
44-
scala-scala
45-
4643
# Ignore output files but keep the directory
4744
out/
4845
build/

.gitmodules

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
path = scala-backend
33
url = https://github.com/lampepfl/scala.git
44
branch = sharing-backend
5+
[submodule "scala2-library"]
6+
path = scala2-library
7+
url = https://github.com/lampepfl/scala.git
8+
branch = dotty-library
59
[submodule "collection-strawman"]
610
path = collection-strawman
7-
url = https://github.com/nicolasstucki/collection-strawman.git
11+
url = https://github.com/scala/collection-strawman.git
12+
branch = master

bot/src/dotty/tools/bot/Main.scala

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ import scalaz.concurrent.Task
77

88
object Main extends ServerApp with PullRequestService {
99

10-
val githubUser = sys.env("GITHUB_USER")
11-
val githubToken = sys.env("GITHUB_TOKEN")
12-
val droneToken = sys.env("DRONE_TOKEN")
13-
val port = sys.env("PORT").toInt
10+
val githubUser = sys.env("GITHUB_USER")
11+
val githubToken = sys.env("GITHUB_TOKEN")
12+
val githubClientId = sys.env("GITHUB_CLIENT_ID")
13+
val githubClientSecret = sys.env("GITHUB_CLIENT_SECRET")
14+
val droneToken = sys.env("DRONE_TOKEN")
15+
val port = sys.env("PORT").toInt
1416

1517
/** Services mounted to the server */
1618
final val services = prService

bot/src/dotty/tools/bot/PullRequestService.scala

Lines changed: 52 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,23 @@ trait PullRequestService {
3434
/** OAuth token for drone, needed to cancel builds */
3535
def droneToken: String
3636

37+
/** OAuthed application's "client_id" */
38+
def githubClientId: String
39+
40+
/** OAuthed application's "client_secret" */
41+
def githubClientSecret: String
42+
3743
/** Pull Request HTTP service */
3844
val prService = HttpService {
45+
case GET -> Root / "rate" => {
46+
val client = PooledHttp1Client()
47+
for {
48+
rates <- client.expect(get(rateLimit))(EntityDecoder.text)
49+
resp <- Ok(rates)
50+
_ <- client.shutdown
51+
} yield resp
52+
}
53+
3954
case request @ POST -> Root =>
4055
val githubEvent =
4156
request.headers
@@ -68,21 +83,28 @@ trait PullRequestService {
6883
)
6984

7085
private[this] val githubUrl = "https://api.github.com"
86+
private[this] def withGithubSecret(url: String, extras: String*): String =
87+
s"$url?client_id=$githubClientId&client_secret=$githubClientSecret" + extras.mkString("&", "&", "")
88+
89+
def rateLimit: String = withGithubSecret("https://api.github.com/rate_limit")
7190

7291
def claUrl(userName: String): String =
7392
s"https://www.lightbend.com/contribute/cla/scala/check/$userName"
7493

7594
def commitsUrl(prNumber: Int): String =
76-
s"$githubUrl/repos/lampepfl/dotty/pulls/$prNumber/commits?per_page=100"
95+
withGithubSecret(s"$githubUrl/repos/lampepfl/dotty/pulls/$prNumber/commits", "per_page=100")
7796

7897
def statusUrl(sha: String): String =
79-
s"$githubUrl/repos/lampepfl/dotty/statuses/$sha"
98+
withGithubSecret(s"$githubUrl/repos/lampepfl/dotty/statuses/$sha")
8099

81100
def issueCommentsUrl(issueNbr: Int): String =
82-
s"$githubUrl/repos/lampepfl/dotty/issues/$issueNbr/comments"
101+
withGithubSecret(s"$githubUrl/repos/lampepfl/dotty/issues/$issueNbr/comments")
83102

84103
def reviewUrl(issueNbr: Int): String =
85-
s"$githubUrl/repos/lampepfl/dotty/pulls/$issueNbr/reviews"
104+
withGithubSecret(s"$githubUrl/repos/lampepfl/dotty/pulls/$issueNbr/reviews")
105+
106+
def contributorsUrl: String =
107+
withGithubSecret("https://api.github.com/repos/lampepfl/dotty/contributors")
86108

87109
sealed trait CommitStatus {
88110
def commit: Commit
@@ -164,6 +186,13 @@ trait PullRequestService {
164186
.headOption
165187
}
166188

189+
/** Get all contributors from GitHub */
190+
def getContributors(implicit client: Client): Task[Set[String]] =
191+
for {
192+
authors <- client.expect(get(contributorsUrl))(jsonOf[List[Author]])
193+
logins = authors.map(_.login).flatten
194+
} yield logins.toSet
195+
167196
/** Ordered from earliest to latest */
168197
def getCommits(issueNbr: Int)(implicit httpClient: Client): Task[List[Commit]] = {
169198
def makeRequest(url: String): Task[List[Commit]] =
@@ -207,8 +236,11 @@ trait PullRequestService {
207236
wrongTense || firstLine.last == '.' || firstLine.length > 80
208237
}
209238

210-
def sendInitialComment(issueNbr: Int, invalidUsers: List[String], commits: List[Commit], client: Client): Task[ReviewResponse] = {
211-
239+
/** Returns the body of a `ReviewResponse` */
240+
def sendInitialComment(issueNbr: Int,
241+
invalidUsers: List[String],
242+
commits: List[Commit],
243+
newContributors: Boolean)(implicit client: Client): Task[String] = {
212244
val cla = if (invalidUsers.nonEmpty) {
213245
s"""|## CLA ##
214246
|In order for us to be able to accept your contribution, all users
@@ -244,9 +276,6 @@ trait PullRequestService {
244276

245277
val body =
246278
s"""|Hello, and thank you for opening this PR! :tada:
247-
|
248-
|If you haven't already, please request a review from one of our
249-
|collaborators (have no fear, we don't bite)!
250279
|
251280
|$cla
252281
|
@@ -256,9 +285,16 @@ trait PullRequestService {
256285

257286
val review = Review.comment(body)
258287

288+
val shouldPost = newContributors || commitRules.nonEmpty || invalidUsers.nonEmpty
289+
259290
for {
260291
req <- post(reviewUrl(issueNbr)).withAuth(githubUser, githubToken)
261-
res <- client.expect(req.withBody(review.asJson))(jsonOf[ReviewResponse])
292+
res <- {
293+
if (shouldPost)
294+
client.expect(req.withBody(review.asJson))(jsonOf[ReviewResponse]).map(_.body)
295+
else
296+
Task.now("")
297+
}
262298
} yield res
263299
}
264300

@@ -283,10 +319,12 @@ trait PullRequestService {
283319
setStatus(statuses.last, httpClient)
284320
}
285321

286-
// Send positive comment:
287-
_ <- sendInitialComment(issue.number, invalidUsers, commits, httpClient)
288-
_ <- httpClient.shutdown
289-
resp <- Ok("Fresh PR checked")
322+
authors = commits.map(_.author.login).flatten.toSet
323+
contribs <- getContributors
324+
newContr = !authors.forall(contribs.contains)
325+
_ <- sendInitialComment(issue.number, invalidUsers, commits, newContr)
326+
_ <- httpClient.shutdown
327+
resp <- Ok("Fresh PR checked")
290328
} yield resp
291329

292330
}

bot/test/PRServiceTests.scala

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@ import org.http4s.client.Client
1515
import scalaz.concurrent.Task
1616

1717
class PRServiceTests extends PullRequestService {
18-
val githubUser = sys.env("GITHUB_USER")
19-
val githubToken = sys.env("GITHUB_TOKEN")
20-
val droneToken = sys.env("DRONE_TOKEN")
18+
val githubUser = sys.env("GITHUB_USER")
19+
val githubToken = sys.env("GITHUB_TOKEN")
20+
val droneToken = sys.env("DRONE_TOKEN")
21+
val githubClientId = sys.env("GITHUB_CLIENT_ID")
22+
val githubClientSecret = sys.env("GITHUB_CLIENT_SECRET")
2123

2224
private def withClient[A](f: Client => Task[A]): A = {
2325
val httpClient = PooledHttp1Client()
@@ -121,13 +123,14 @@ class PRServiceTests extends PullRequestService {
121123
@Test def canPostReview = {
122124
val invalidUsers = "felixmulder" :: "smarter" :: Nil
123125
val commit = Commit("", Author(Some("smarter")), Author(Some("smarter")), CommitInfo("Added stuff"))
124-
val res = withClient(sendInitialComment(2281, invalidUsers, commit :: Nil, _))
126+
val resBody =
127+
withClient(sendInitialComment(2281, invalidUsers, commit :: Nil, false)(_))
125128

126129
assert(
127-
res.body.contains("We want to keep history") &&
128-
res.body.contains("Could you folks please sign the CLA?") &&
129-
res.body.contains("Have an awesome day!"),
130-
s"Body of review was not as expected:\n${res.body}"
130+
resBody.contains("We want to keep history") &&
131+
resBody.contains("Could you folks please sign the CLA?") &&
132+
resBody.contains("Have an awesome day!"),
133+
s"Body of review was not as expected:\n${resBody}"
131134
)
132135
}
133136

@@ -157,4 +160,9 @@ class PRServiceTests extends PullRequestService {
157160

158161
assert(respondToComment(issueComment).run.status.code == 200)
159162
}
163+
164+
@Test def canGetContributors = {
165+
val contributors = withClient(getContributors(_))
166+
assert(contributors.contains("felixmulder"))
167+
}
160168
}

compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
634634
toDenot(sym)(shiftedContext).isStatic(shiftedContext)
635635
}
636636

637-
def isStaticConstructor: Boolean = (isStaticMember && isClassConstructor) || (sym.name eq core.Names.STATIC_CONSTRUCTOR)
637+
def isStaticConstructor: Boolean = (isStaticMember && isClassConstructor) || (sym.name eq nme.STATIC_CONSTRUCTOR)
638638

639639

640640
// navigation

compiler/src/dotty/tools/dotc/FromTasty.scala

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,7 @@ object FromTasty extends Driver {
7474
def readTASTY(unit: CompilationUnit)(implicit ctx: Context): CompilationUnit = unit match {
7575
case unit: TASTYCompilationUnit =>
7676
val className = unit.className.toTypeName
77-
val clsd =
78-
if (className.is(QualifiedName)) ctx.base.staticRef(className)
79-
else defn.EmptyPackageClass.info.decl(className)
77+
val clsd = ctx.base.staticRef(className)
8078
def cannotUnpickle(reason: String) = {
8179
ctx.error(s"class $className cannot be unpickled because $reason")
8280
unit

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

Lines changed: 7 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ object desugar {
2727

2828
/** Names of methods that are added unconditionally to case classes */
2929
def isDesugaredCaseClassMethodName(name: Name)(implicit ctx: Context): Boolean =
30-
name == nme.copy ||
31-
name == nme.productArity ||
32-
name.isSelectorName
30+
name == nme.copy || name.isSelectorName
3331

3432
// ----- DerivedTypeTrees -----------------------------------
3533

@@ -291,7 +289,8 @@ object desugar {
291289
case _ => false
292290
}
293291

294-
val isCaseClass = mods.is(Case) && !mods.is(Module)
292+
val isCaseClass = mods.is(Case) && !mods.is(Module)
293+
val isCaseObject = mods.is(Case) && mods.is(Module)
295294
val isEnum = mods.hasMod[Mod.Enum]
296295
val isEnumCase = isLegalEnumCase(cdef)
297296
val isValueClass = parents.nonEmpty && isAnyVal(parents.head)
@@ -360,31 +359,12 @@ object desugar {
360359
// pN: TN = pN: @uncheckedVariance)(moreParams) =
361360
// new C[...](p1, ..., pN)(moreParams)
362361
//
363-
// Above arity 22 we also synthesize:
364-
// def productArity = N
365-
// def productElement(i: Int): Any = i match { ... }
366-
//
367362
// Note: copy default parameters need @uncheckedVariance; see
368363
// neg/t1843-variances.scala for a test case. The test would give
369364
// two errors without @uncheckedVariance, one of them spurious.
370365
val caseClassMeths = {
371366
def syntheticProperty(name: TermName, rhs: Tree) =
372367
DefDef(name, Nil, Nil, TypeTree(), rhs).withMods(synthetic)
373-
def productArity = syntheticProperty(nme.productArity, Literal(Constant(arity)))
374-
def productElement = {
375-
val param = makeSyntheticParameter(tpt = ref(defn.IntType))
376-
// case N => _${N + 1}
377-
val cases = 0.until(arity).map { i =>
378-
CaseDef(Literal(Constant(i)), EmptyTree, Select(This(EmptyTypeIdent), nme.selectorName(i)))
379-
}
380-
val ioob = ref(defn.IndexOutOfBoundsException.typeRef)
381-
val error = Throw(New(ioob, List(List(Select(refOfDef(param), nme.toString_)))))
382-
// case _ => throw new IndexOutOfBoundsException(i.toString)
383-
val defaultCase = CaseDef(untpd.Ident(nme.WILDCARD), EmptyTree, error)
384-
val body = Match(refOfDef(param), (cases :+ defaultCase).toList)
385-
DefDef(nme.productElement, Nil, List(List(param)), TypeTree(defn.AnyType), body)
386-
.withMods(synthetic)
387-
}
388368
def productElemMeths = {
389369
val caseParams = constrVparamss.head.toArray
390370
for (i <- 0 until arity if nme.selectorName(i) `ne` caseParams(i).name)
@@ -414,33 +394,19 @@ object desugar {
414394
}
415395
}
416396

417-
// Above MaxTupleArity we extend Product instead of ProductN, in this
418-
// case we need to synthesise productElement & productArity.
419-
def largeProductMeths =
420-
if (arity > Definitions.MaxTupleArity) productElement :: productArity :: Nil
421-
else Nil
422-
423397
if (isCaseClass)
424-
largeProductMeths ::: copyMeths ::: enumTagMeths ::: productElemMeths.toList
398+
copyMeths ::: enumTagMeths ::: productElemMeths.toList
425399
else Nil
426400
}
427401

428402
def anyRef = ref(defn.AnyRefAlias.typeRef)
429-
def productConstr(n: Int) = {
430-
val tycon = scalaDot((str.Product + n).toTypeName)
431-
val targs = constrVparamss.head map (_.tpt)
432-
if (targs.isEmpty) tycon else AppliedTypeTree(tycon, targs)
433-
}
434-
def product =
435-
if (arity > Definitions.MaxTupleArity) scalaDot(str.Product.toTypeName)
436-
else productConstr(arity)
437403

438-
// Case classes and case objects get Product/ProductN parents
404+
// Case classes and case objects get Product parents
439405
var parents1 = parents
440406
if (isEnumCase && parents.isEmpty)
441407
parents1 = enumClassTypeRef :: Nil
442-
if (mods.is(Case))
443-
parents1 = parents1 :+ product // TODO: This also adds Product0 to case objects. Do we want that?
408+
if (isCaseClass | isCaseObject)
409+
parents1 = parents1 :+ scalaDot(str.Product.toTypeName)
444410
if (isEnum)
445411
parents1 = parents1 :+ ref(defn.EnumType)
446412

@@ -499,7 +465,6 @@ object desugar {
499465
companionDefs(anyRef, Nil)
500466
else Nil
501467

502-
503468
// For an implicit class C[Ts](p11: T11, ..., p1N: T1N) ... (pM1: TM1, .., pMN: TMN), the method
504469
// synthetic implicit C[Ts](p11: T11, ..., p1N: T1N) ... (pM1: TM1, ..., pMN: TMN): C[Ts] =
505470
// new C[Ts](p11, ..., p1N) ... (pM1, ..., pMN) =

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ object Trees {
233233
/** Tree's denotation can be derived from its type */
234234
abstract class DenotingTree[-T >: Untyped] extends Tree[T] {
235235
type ThisTree[-T >: Untyped] <: DenotingTree[T]
236-
override def denot(implicit ctx: Context) = tpe match {
236+
override def denot(implicit ctx: Context) = typeOpt match {
237237
case tpe: NamedType => tpe.denot
238238
case tpe: ThisType => tpe.cls.denot
239239
case tpe: AnnotatedType => tpe.stripAnnots match {
@@ -363,7 +363,7 @@ object Trees {
363363
type ThisTree[-T >: Untyped] = This[T]
364364
// Denotation of a This tree is always the underlying class; needs correction for modules.
365365
override def denot(implicit ctx: Context): Denotation = {
366-
tpe match {
366+
typeOpt match {
367367
case tpe @ TermRef(pre, _) if tpe.symbol is Module =>
368368
tpe.symbol.moduleClass.denot.asSeenFrom(pre)
369369
case _ =>

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,8 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
517517
cpy.ContextBounds(tree)(transformSub(bounds), transform(cxBounds))
518518
case PatDef(mods, pats, tpt, rhs) =>
519519
cpy.PatDef(tree)(mods, transform(pats), transform(tpt), transform(rhs))
520+
case TypedSplice(_) =>
521+
tree
520522
case _ =>
521523
super.transform(tree)
522524
}

compiler/src/dotty/tools/dotc/config/ScalaSettings.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ class ScalaSettings extends Settings.SettingGroup {
4141
val strict = BooleanSetting("-strict", "Use strict type rules, which means some formerly legal code does not typecheck anymore.")
4242
val language = MultiStringSetting("-language", "feature", "Enable one or more language features.")
4343
val rewrite = OptionSetting[Rewrites]("-rewrite", "When used in conjunction with -language:Scala2 rewrites sources to migrate to new syntax")
44+
val silentWarnings = BooleanSetting("-nowarn", "Silence all warnings.")
4445

4546
val linkDCE = BooleanSetting("-link-dce", "Enable dead code elimination.")
4647
val linkDCEAggressive = BooleanSetting("-link-aggressive-dce", "Enable aggressive dead code elimination.")

0 commit comments

Comments
 (0)