Skip to content

Scalafmt added #2

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
target/
.bsp/
.bsp/
.idea/
32 changes: 32 additions & 0 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
version = "3.5.8"
runner.dialect = scala3
align.openParenCallSite = true
align.openParenDefnSite = true
assumeStandardLibraryStripMargin = true
continuationIndent.defnSite = 2
continuationIndent.callSite = 2
continuationIndent.ctorSite = 2
danglingParentheses.preset = true
docstrings.style = Asterisk
docstrings.oneline = unfold
indent.main = 2
maxColumn = 120
newlines.afterCurlyLambda = preserve
rewrite.rules = [AvoidInfix, SortImports, RedundantParens, SortModifiers]
rewrite.scala3.convertToNewSyntax = true
rewrite.scala3.removeOptionalBraces = yes
rewrite.sortModifiers.order = [
implicit
final
sealed
abstract
override
private
protected
lazy
open
transparent
inline
infix
opaque
]
26 changes: 25 additions & 1 deletion src/main/scala/Test.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,35 @@ class Test {

inline def test(fun: => Any): Any = fun

/* This works as of 3.1.3 */
test {
case class Pair[X, Y](
x: X,
y: Y,
)
}

}
/**
* This does not work as of 3.1.3
* Self-types are not resolved, this does work though if
* Moveable and Vehicle are removed from the test context
*/
test {
transparent trait Moveable {
def increaseSpeed(ms: Int): Moveable
def decreaseSpeed(ms: Int): Moveable
}

trait Vehicle { self: Moveable =>
def make: String
def model: String
}

class Car(val make: String, val model: String, val currentSpeed: Int) extends Vehicle with Moveable {
override def increaseSpeed(ms: Int):Car = new Car(make, model, currentSpeed + ms)
override def decreaseSpeed(ms: Int):Car = new Car(make, model, currentSpeed - ms)
}

val ford:Car = new Car("Ford", "Fiesta", 110).decreaseSpeed(20)
}
}