Skip to content

Commit 917602c

Browse files
committed
Merge pull request scala#4241 from kanielc/SI-6778
SI-6778 scala.math.random should have parenthesis
2 parents 9149cc9 + 004a1d6 commit 917602c

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

src/library/scala/math/package.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ package object math {
2626
/** Returns a `double` value with a positive sign, greater than or equal
2727
* to `0.0` and less than `1.0`.
2828
*/
29-
def random: Double = java.lang.Math.random()
29+
def random(): Double = java.lang.Math.random()
3030

3131
def sin(x: Double): Double = java.lang.Math.sin(x)
3232
def cos(x: Double): Double = java.lang.Math.cos(x)

test/files/pos/t6778.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
object test extends AnyRef with App {
2+
// Check that random can be called with parenthesis.
3+
scala.math.random()
4+
}
5+

test/files/run/analyzerPlugins.check

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ canAdaptAnnotations(Trees$Typed, Any) [1]
1919
canAdaptAnnotations(Trees$Typed, Int) [1]
2020
lub(List(Int @testAnn, Int)) [1]
2121
pluginsPt(?, Trees$Annotated) [7]
22-
pluginsPt(?, Trees$Apply) [8]
22+
pluginsPt(?, Trees$Apply) [11]
2323
pluginsPt(?, Trees$ApplyImplicitView) [2]
2424
pluginsPt(?, Trees$Assign) [7]
2525
pluginsPt(?, Trees$Block) [4]
@@ -31,7 +31,7 @@ pluginsPt(?, Trees$Literal) [16]
3131
pluginsPt(?, Trees$New) [5]
3232
pluginsPt(?, Trees$PackageDef) [1]
3333
pluginsPt(?, Trees$Return) [1]
34-
pluginsPt(?, Trees$Select) [47]
34+
pluginsPt(?, Trees$Select) [50]
3535
pluginsPt(?, Trees$Super) [2]
3636
pluginsPt(?, Trees$This) [20]
3737
pluginsPt(?, Trees$TypeApply) [3]
@@ -93,6 +93,7 @@ pluginsTypeSigAccessor(value x) [1]
9393
pluginsTypeSigAccessor(value y) [1]
9494
pluginsTypeSigAccessor(variable count) [2]
9595
pluginsTyped( <: Int, Trees$TypeBoundsTree) [2]
96+
pluginsTyped(()Double, Trees$Select) [6]
9697
pluginsTyped(()Object, Trees$Select) [1]
9798
pluginsTyped(()String, Trees$Ident) [1]
9899
pluginsTyped(()String, Trees$TypeApply) [1]
@@ -112,7 +113,7 @@ pluginsTyped(<notype>, Trees$PackageDef) [1]
112113
pluginsTyped(<notype>, Trees$TypeDef) [1]
113114
pluginsTyped(<notype>, Trees$ValDef) [21]
114115
pluginsTyped(=> Boolean @testAnn, Trees$Select) [1]
115-
pluginsTyped(=> Double, Trees$Select) [4]
116+
pluginsTyped(=> Double, Trees$Select) [1]
116117
pluginsTyped(=> Int, Trees$Select) [5]
117118
pluginsTyped(=> Int, Trees$TypeApply) [1]
118119
pluginsTyped(=> String @testAnn, Trees$Select) [1]
@@ -131,6 +132,7 @@ pluginsTyped(Boolean(false), Trees$Literal) [2]
131132
pluginsTyped(Boolean, Trees$Apply) [1]
132133
pluginsTyped(Boolean, Trees$Select) [4]
133134
pluginsTyped(Char('c'), Trees$Literal) [2]
135+
pluginsTyped(Double, Trees$Apply) [3]
134136
pluginsTyped(Double, Trees$Select) [6]
135137
pluginsTyped(Int @testAnn, Trees$TypeTree) [2]
136138
pluginsTyped(Int @testAnn, Trees$Typed) [2]

0 commit comments

Comments
 (0)