-
Notifications
You must be signed in to change notification settings - Fork 142
/
Copy pathtestfile.scala
183 lines (154 loc) · 5.27 KB
/
testfile.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
package testfile
import java.something.com
package object SomeObject[A <: B] extends Implicits {
type Booger[A] = A => Unit
type SomeType = A <: B :> C
type SomeOtherType = A ⇒ Thing
type Something
type Something <: SomethingElse
type ParserContext = Context { type PrefixType = Parser }
new Something#SomethingElse
val GET, HEAD, POST, PUT, DELETE, TRACE, OPTIONS, CONNECT, PATCH = Value
// Doesn't yet work
val GET, HEAD: Value, POST, PUT, DELETE, TRACE, OPTIONS, CONNECT, PATCH: Value = Value
def x: Something#SomethingElse
def hasFunctionType[A, B <: A, Z](f: A => B, g: (A, B) => Z): Unit = {
println("Something")
}
val f: (Int, String) => Unit = (i: Int, s: String) => println(s"$i -- $s")
val f: (Int, String) ⇒ Unit = (i: Int, s: String) ⇒ println(s"$i -- $s")
}
object Test {
def test(
param1: List[(Int, Int)],
param2: List[Int]):
List[Int] = {
param2 match {
case head :: tail => tail
}
}
}
case class ACaseClass(param1: Float = 14.23f)
case object ACaseObject extends Something
def x(): Unit = {
case Something(a, b) =>
case SomethingElse() =>
case SomethingElseElse =>
}
class ScalaClass(i: Int = 12, b: Trait[A, Trait[B, C]]) extends B with SomeTrait[A, B[String], D] {
/**
* I forgot comments! We spelcheck them. [[scala.Option]]
*
* {{{
* scala> This is a REPL line
* scala> and this is another one
* }}}
*
* <li></li>
*
* @param parameter Explanation of the parameter. Speling.
* @return TODO
*/
val thing = "A String" // this is a trailing comment, spelchecked too [TODO]
val thing = "A String with a \" in it"
val intString = "A string with $stuff // and a comment in it"
val intString = s"A string /* a comment and */ with $stuff and ${stuff} in it"
val intString = s"""A string /* a comment and */ with $stuff and ${stuff} in it"""
val intFString = f"A string with $stuff and ${stuff} and ${eval this}%-2.2f and $stuff%2d in it"
val intFString = f"""A string with $stuff and ${stuff} and ${eval this}%-2.2f and $stuff%2d in it"""
val otherThings = """|This is a string
|that spans multiple lines.
|""".stripMargin
val intString = sql"select * from T where id = $id and name = ${name}"
val intString = sql"""
select * from T
where id = $id and name = ${s"$name Jr"} and age > ${age + 10}
"""
val notImplemented = ???
implicit val somethingImplicit = true
// Ripped off from Scalaz
final def foldMap[B: Monoid](f: A => B = (a: A) => A): B = F.foldMap(self)(f)
final def foldRight[B](z: => B)(f: (A, => B) => B): B = F.foldRight(self, z)(f)
final def foldLeft[B](z: B)(f: (B, A) => B): B = F.foldLeft(self, z)(f)
final def foldRightM[G[_], B](z: => B)(f: (A, => B) => G[B])(implicit M: Monad[G]): G[B] = F.foldRightM(self, z)(f)
final def foldLeftM[G[_], B](z: B)(f: (B, A) => G[B])(implicit M: Monad[G]): G[B] = F.foldLeftM(self, z)(f)
final def foldr[B](z: => B)(f: A => (=> B) => B): B = F.foldr(self, z)(f)
final def foldl[B](z: B)(f: B => A => B): B = F.foldl(self, z)(f)
final def foldrM[G[_], B](z: => B)(f: A => ( => B) => G[B])(implicit M: Monad[G]): G[B] = F.foldrM(self, z)(f)
val aChar = 'a'
val anEscapedChar = '\\'
val anotherEscapedChar = '\n'
val aUnicodeChar = '\u00ab'
val aSymbol = 'SomeSymbol
def number = 0xAf903adeL
def float = 1f
def float = 1F
def float = 1.1f
def float = 1.1F
def float = 231.1232f
def float = 231.2321F
def float = .2f
def float = .2F
def double = 1d
def double = 1D
def double = 1.1d
def double = 1.1D
def double = 231.1232d
def double = 231.2321D
def double = 231.2321
def double = .2d
def double = .2
def double = .2D
def exp = 1.2342e-24
def exp = 1e+24
var flarf: Int = 12
def flooger(x: String): Unit = println(42)
private val booger = "Hithere"
protected[this] def something[A](y: SomeTrait[A])(implicit shoot: Function[Int, String]): Long = 12
private final val do = done
someVar match {
case Flooger(thing, that, matches) =>
flender ! Message(hi, there, guys)
case '"' => Bah
}
try {
whatever
} catch {
case e: Throwable
} finally {
at the end
}
while (a == b) {
}
for (x <- somecall) {
dothing
}
for {
a <- futureCall1
b <- futureCall2
} yield (a, b)
protected[package] something = null
def receive = super.receive
require(something == true)
val q"This $is a $string" = something
q"""return this $thing"""
tq"""return this $thing"""
tq"return this $thing"
cq"""return this $thing"""
cq"return this $thing"
pq"""return this $thing"""
pq"return this $thing"
val something = s"""bar="foo""""
val something = f"""bar="foo""""
val something = """bar="foo""""
val something = s"Interpolatin' fancy expressions ${bar map (_.toString)}"
def someFunc[A <: B, X =:= Y]
func["(singleton"]
val soManyEscapes = "\\\"\u0031\n\b\r\f\t" // and a comment
val soManyEscapes = """\\\"\u0031\n\b\r\f\t""" // and a comment
val soManyEscapes = s"\\\"\u0031\n\b\r\f\t" // and a comment
val soManyEscapes = f"\\\"\u0031\n\b\r\f\t" // and a comment
val soManyEscapes = s"""\\\"\u0031\n\b\r\f\t""" // and a comment
val soManyEscapes = f"""\\\"\u0031\n\b\r\f\t""" // and a comment
val soManyEscapes = "\\\"\u0031\n\b\r\f\t" // and a comment
}