Skip to content

Small fixes to some warnings/comment typos #1565

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

Merged
merged 4 commits into from
Oct 14, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package dotty.tools.dotc.interfaces;

import java.io.File;

/** A source file.
*
* User code should not implement this interface, but it may have to
Expand Down
4 changes: 2 additions & 2 deletions src/dotty/tools/dotc/ast/Trees.scala
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ object Trees {
* the existing tree transparently, assigning its `tpe` field,
* provided it was `null` before.
* - It is impossible to embed untyped trees in typed ones.
* - Typed trees can be embedded untyped ones provided they are rooted
* - Typed trees can be embedded in untyped ones provided they are rooted
* in a TypedSplice node.
* - Type checking an untyped tree should remove all embedded `TypedSplice`
* nodes.
Expand Down Expand Up @@ -855,7 +855,7 @@ object Trees {

val cpy: TreeCopier

/** A class for copying trees. The copy methods avid creating a new tree
/** A class for copying trees. The copy methods avoid creating a new tree
* If all arguments stay the same.
*
* Note: Some of the copy methods take a context.
Expand Down
4 changes: 2 additions & 2 deletions src/dotty/tools/dotc/transform/TreeTransform.scala
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ object TreeTransforms {
* the general dispatch overhead as opposed to the concrete work done in transformations. So that leaves us with
* 0.2sec, or roughly 600M processor cycles.
*
* Now, to the amount of work that needs to be done. The codebase produces of about 250'000 trees after typechecking.
* Now, to the amount of work that needs to be done. The codebase produces an average of about 250'000 trees after typechecking.
* Transformations are likely to make this bigger so let's assume 300K trees on average. We estimate to have about 100
* micro-transformations. Let's say 5 transformation groups of 20 micro-transformations each. (by comparison,
* scalac has in excess of 20 phases, and most phases do multiple transformations). There are then 30M visits
Expand Down Expand Up @@ -208,7 +208,7 @@ object TreeTransforms {
if (cls.getDeclaredMethods.exists(_.getName == name)) cls != classOf[TreeTransform]
else hasRedefinedMethod(cls.getSuperclass, name)

/** Create an index array `next` of size one larger than teh size of `transforms` such that
/** Create an index array `next` of size one larger than the size of `transforms` such that
* for each index i, `next(i)` is the smallest index j such that
*
* i <= j
Expand Down
2 changes: 1 addition & 1 deletion src/dotty/tools/dotc/typer/TypeAssigner.scala
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ trait TypeAssigner {

def assignType(tree: untpd.SeqLiteral, elems: List[Tree], elemtpt: Tree)(implicit ctx: Context) = {
val ownType = tree match {
case tree: JavaSeqLiteral => defn.ArrayOf(elemtpt.tpe)
case tree: untpd.JavaSeqLiteral => defn.ArrayOf(elemtpt.tpe)
case _ => if (ctx.erasedTypes) defn.SeqType else defn.SeqType.appliedTo(elemtpt.tpe)
}
tree.withType(ownType)
Expand Down
4 changes: 2 additions & 2 deletions src/strawman/collections/CollectionStrawMan4.scala
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ object CollectionStrawMan4 {

object ListBuffer extends IterableFactory[ListBuffer] {
def fromIterable[B](coll: Iterable[B]): ListBuffer[B] = coll match {
case pd @ View.Partitioned(partition: View.Partition[B]) =>
case pd @ View.Partitioned(partition: View.Partition[B] @unchecked) =>
partition.distribute(new ListBuffer[B]())
new ListBuffer[B] ++= pd.forced.get
case _ =>
Expand Down Expand Up @@ -267,7 +267,7 @@ object CollectionStrawMan4 {
Array.copy(fst.elems, fst.start, elems, 0, fst.length)
Array.copy(snd.elems, snd.start, elems, fst.length, snd.length)
new ArrayBuffer(elems, elems.length)
case pd @ View.Partitioned(partition: View.Partition[B]) =>
case pd @ View.Partitioned(partition: View.Partition[B] @unchecked) =>
partition.distribute(new ArrayBuffer[B]())
pd.forced.get.asInstanceOf[ArrayBuffer[B]]
case c if c.knownLength >= 0 =>
Expand Down
6 changes: 3 additions & 3 deletions test/test/ContextEscapeDetector.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package test;

import org.junit.runner.Description;
import org.junit.runner.Result;
import org.junit.runner.notification.RunListener;
import org.junit.Assert;
Expand Down Expand Up @@ -43,6 +42,7 @@ private static synchronized int contextsAlive() {
return count;
}

@SuppressWarnings("unused")
private static volatile Object o = null;

private static synchronized void forceGCHeuristic0() {
Expand All @@ -59,7 +59,7 @@ private static synchronized void forceGCHeuristic0() {

private static synchronized void forceGCHeuristic1() {
Object obj = new Object();
WeakReference ref = new WeakReference<Object>(obj);
WeakReference<Object> ref = new WeakReference<>(obj);
obj = null;
while (ref.get() != null) {
System.gc();
Expand All @@ -69,7 +69,7 @@ private static synchronized void forceGCHeuristic1() {
private static synchronized void forceGCHeuristic2() {
try {
Object[] arr = new Object[1024]; // upto 8 GB
WeakReference ref = new WeakReference<Object>(arr);
WeakReference<Object> ref = new WeakReference<>(arr);
o = arr; // make sure array isn't optimized away

Runtime runtime = Runtime.getRuntime();
Expand Down