Skip to content

Commit a5ee1a9

Browse files
tekPeng Cheng
authored andcommitted
create analyzer plugin for 2.13.6
version -> 1.0.0-SNAPSHOT remove all cross-versions below 2.13.6 add testing option "-Vimplicits -Vtype-diffs" sbt upgrade to 1.5.5 fix all sbt deprecation warning ignore .bsp cleanup all code for scala-2.13.5- add all tests in scalac, unfortunately none of them works. add diverging in DevSpec first version, all tests are not working add wrapper jar and properties remove ignored files cleanup buildSrc switch to scalatest from specs2 most native tests are now working skip 3 tests and enable scalatest in gradle test fixed existing tests in scalac. The next patch will fix existing tests in splain plugin INCOMPLETE, figuring out a path for DIE erroro most tests has been fixed/ignored except zlayer All tests are now working, the zio ground truth may be problematic aux changed to auxPattern to avoid a naming conflict on Windows fix a typo project ID when publishing now carries scala version test directory on github action revise readme re-organise some tests fix zio tests finished README RefinedFormatter is no longer used, superseded by RefinedFormatterImproved add publishing information
1 parent d331846 commit a5ee1a9

230 files changed

Lines changed: 2534 additions & 2159 deletions

File tree

Some content is hidden

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

.github/workflows/main.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ jobs:
1212
fail-fast: false
1313
matrix:
1414
version: [
15-
"2.12.5","2.12.6","2.12.7","2.12.8","2.12.9","2.12.10","2.12.11","2.12.12","2.12.13","2.12.14", "2.12.15",
16-
"2.13.1","2.13.2","2.13.3","2.13.4","2.13.5"
15+
"2.13.6"
1716
]
1817

1918
steps:
@@ -23,14 +22,14 @@ jobs:
2322
with:
2423
java-version: 1.8
2524
- name: Compile
26-
run: sbt ++${{matrix.version}} clean publishM2
25+
run: ./dev/make-all.sh
2726
- name: Test
28-
run: sbt ++${{matrix.version}} test
27+
run: ./dev/test.sh
2928
- name: Publish Unit Test Results
3029
uses: EnricoMi/publish-unit-test-result-action@v1
3130
if: always()
3231
with:
3332
files: |
34-
**/test-reports/*.xml
33+
**/test-results/test/*.xml
3534
check_name: |
3635
Test Report (${{matrix.version}})

.gitignore

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,60 @@
1+
*.class
2+
*.log
3+
logs/**
4+
5+
# maven
6+
*.versionsBackup
7+
8+
# gradle
9+
**/.gradle/*
10+
**/build
11+
12+
# sbt
13+
.cache/
14+
.history/
15+
.lib/
16+
dist/*
117
target/
18+
lib_managed/
19+
src_managed/
20+
project/boot/
21+
project/plugins/project/
22+
23+
# Scala-IDE
24+
.scala_dependencies
25+
.worksheet
26+
27+
# Eclipse
28+
.pmd
29+
.classpath
30+
.project
31+
.settings/
232

33+
# IntelliJ-IDEA
34+
*.iml
335
.idea/
36+
.idea_modules/
437

38+
# VSCode
539
.vscode/
6-
**/.bloop
40+
41+
# BSP & Metals
42+
.bsp/
43+
.bloop/
744
.metals/
845
**/metals.sbt
46+
47+
# the Singapore stack
48+
**/.ammonite/
49+
50+
# Compiler
51+
output
52+
*/target/
53+
54+
#Misc
55+
temp
56+
**/temp
57+
foo
58+
59+
#aws key
60+
**/rootkey.csv

.scalafmt.conf

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,39 @@
11
version = "2.7.5"
2-
3-
maxColumn = 120
4-
continuationIndent.defnSite = 2
5-
continuationIndent.extendSite = 0
6-
align.preset = none
7-
align.tokens = []
8-
align.openParenCallSite = false
9-
align.openParenDefnSite = false
10-
newlines.beforeMultiline = unfold
11-
newlines.beforeMultilineDef = unfold
12-
rewrite.rules = [AvoidInfix, RedundantBraces, RedundantParens]
13-
rewrite.redundantBraces.stringInterpolation = true
14-
rewrite.redundantBraces.ifElseExpressions = true
15-
trailingCommas = always
16-
includeNoParensInSelectChains = true
2+
maxColumn=120
173

184
# Only format files tracked by git.
195
project.git=true
6+
7+
align {
8+
preset = some
9+
tokens = []
10+
}
11+
12+
docstrings {
13+
blankFirstLine = true
14+
}
15+
16+
newlines {
17+
# topLevelStatements = [before]
18+
sometimesBeforeColonInMethodReturnType = false
19+
penalizeSingleSelectMultiArgList = false
20+
beforeCurlyLambdaParams = multilineWithCaseOnly
21+
# // afterCurlyLambdaParams = squash
22+
implicitParamListModifierForce = [before,after]
23+
}
24+
25+
rewrite {
26+
rules = [
27+
# // AvoidInfix,
28+
RedundantBraces,
29+
RedundantParens,
30+
SortModifiers,
31+
SortImports
32+
]
33+
redundantBraces {
34+
generalExpressions = false
35+
methodBodies = false
36+
includeUnitMethods = false
37+
maxLines = 0
38+
}
39+
}

README.md

Lines changed: 111 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,34 @@
33
This plugin removes some of the redundancy of the compiler output and prints
44
additional info for implicit resolution errors.
55

6+
# Releases
7+
8+
### built-in - Scala 2.13.6+
9+
10+
Most features in splain 0.5.8 has been integrated into Scala 2.13.6 compiler through [this patch](https://github.com/scala/scala/pull/7785).
11+
12+
- Recommended if using Scala 2.13 and only splain 0.5.8 features. However, ...
13+
- **This integration is not 100%!** Configuration parameters have to be given new names to be compliant with the compiler standard. Many features are also discarded.
14+
15+
### v1.x (current) - Scala 2.13.6+
16+
17+
The above integration introduces a new compiler extension type (AnalyzerPlugin) that rendered most of old source code for splain v0.x incompatible or redundant. Thus, the team have decided to move on to the next major version, designed from scratch to have a cleaner architecture and better test coverage. Unfortunately, it will **not be available for Scala 2.13.5-**
18+
19+
- Recommended if using Scala 2.13 and the latest splain features/bugfixes.
20+
- PRs and issues submitted for it will be given priority.
21+
22+
### v0.x (maintenance) - Scala 2.12, 2.13.5-
23+
24+
The latest v0.x will continue to be maintained and published regularly to stay compatible with the latest Scala 2.12.x release (until it's end-of-life), but no newer version will be published for Scala 2.13, **splain 0.5.8 will be the last release for Scala 2.13**.
25+
26+
If you are already using Scala 2.13, the team strongly recommend you to upgrade, and submit bug report and test cases directly to the latest v1.x.
27+
28+
- Recommended if using Scala 2.12.
29+
630
# Usage
731

32+
### v1.x, v0.x
33+
834
Include this line in your `build.sbt` (_not_ `project/plugins.sbt`!!):
935

1036
```sbt
@@ -34,25 +60,39 @@ or build.gradle.kts:
3460
scalaCompilerPlugins("io.tryp:splain_${scalaVersion}:0.5.8")
3561
```
3662

37-
# Configuration
38-
The plugin can be configured via compiler plugin parameters with the format:
63+
### built-in
64+
65+
Do nothing! It is already built-in. Its 2 minimal features however has to be enabled manually, by the following 2 compiler arguments (see Configuration for details):
66+
3967
```
40-
-P:splain:<param>[:<value>]
68+
-Vimplicits -Vtype-diffs
4169
```
70+
71+
# Configuration
72+
73+
The plugin can be configured via compiler arguments with the format:
74+
75+
| v0.x | built-in, v1.x |
76+
| :---------------------------- | -------------------- |
77+
| `-P:splain:<param>[:<value>]` | `-<param>[ <value>]` |
78+
4279
`param` can be one of the following:
43-
* `all`
44-
* `infix`
45-
* `foundreq`
46-
* `implicits`
47-
* `bounds` (default off)
48-
* `color`
49-
* `breakinfix` (default 0)
50-
* `tree`
51-
* `compact` (default off)
52-
* `boundsimplicits`
53-
* `truncrefined` (default 0)
54-
* `rewrite` (string)
55-
* `keepmodules` (default 0)
80+
81+
| v0.x | built-in, v1.x | default value |
82+
| ----------------- | ------------------------- | ---------------- |
83+
| `all` | (dropped) | |
84+
| `infix` | (dropped) | |
85+
| `foundreq` | `Vtype-diffs` | |
86+
| `implicits` | `Vimplicits` | |
87+
| `bounds` | (dropped) | false |
88+
| `color` | (dropped) | |
89+
| `breakinfix` | (dropped) | 0 |
90+
| `tree` | `Vimplicits-verbose-tree` | |
91+
| `compact` | (dropped) | false |
92+
| `boundsimplicits` | (dropped) | |
93+
| `truncrefined` | `Vimplicits-max-refined` | 0 |
94+
| `rewrite` | (dropped) | (do not rewrite) |
95+
| `keepmodules` | (dropped) | 0 |
5696

5797
`value` can either be `true` or `false`. If omitted, the default is `true` for
5898
both value and parameter.
@@ -71,12 +111,8 @@ scalacOptions += "-P:splain:implicits:false"
71111

72112
```kotlin
73113
withType<ScalaCompile> {
74-
75114
scalaCompileOptions.apply {
76-
77-
additionalParameters = listOf(
78-
"-P:splain:implicits:false"
79-
)
115+
additionalParameters = listOf("-P:splain:implicits:false")
80116
}
81117
}
82118
```
@@ -207,10 +243,63 @@ So with `-P:splain:keepmodules:2`, the qualified type `cats.free.FreeT.Suspend`
207243
`free.FreeT.Suspend`, keeping the two segments `free.FreeT` before the type name.
208244
The default is `0`, so only the type name itself will be displayed
209245

210-
# bugs
246+
# Development
247+
248+
## Bugs
211249

212250
Due to the nature of the hack that allows _splain_ to hook into the implicit search algorithm, other plugins using the
213251
same trick may not work or cause _splain_ to be inactive.
214252

215253
Another victim of _splain_ is scaladoc – doc comments might disappear when running the task with _splain_ active, so
216254
make sure it is disabled before doing so.
255+
256+
Users are encouraged to submit issues and test cases directly through pull requests, by forking the project and adding new test cases under:
257+
258+
| v0.x | v1.x |
259+
| :------------------------------------- | -------------------------------------------------- |
260+
| `<project root>/src/test/scala/splain` | `<project root>/core/src/test/scala/splain/plugin` |
261+
262+
The bug can thus be identified by the team quickly on our [continuous integration environment](https://github.com/tek/splain/actions). Submission on our GitHub issue tracker is also welcomed, but it generally takes much longer for the team to respond.
263+
264+
## How to compile
265+
266+
### v0.x
267+
268+
Built with the latest stable (SBT)[https://www.scala-sbt.org/]. to compile and publish locally:
269+
270+
```
271+
sbt clean publishM2
272+
```
273+
274+
to run all tests:
275+
276+
```
277+
sbt test
278+
```
279+
280+
### v1.x
281+
282+
Built with the latest Gradle (https://gradle.org/), to compile and publish locally:
283+
284+
```
285+
./gradlew clean testClasses publishToMavenLocal
286+
```
287+
288+
to run all tests:
289+
290+
```
291+
./gradlew test
292+
```
293+
294+
## How to edit
295+
296+
Most project contributors uses neovim, IntelliJ IDEA or visual studio code.
297+
298+
The team strive for a strong discipline in software engineering. All commits (including SNAPSHOTs and PRs) will be compliant with (scalalfmt)[https://scalameta.org/scalafmt/] standard.
299+
300+
## Communication
301+
302+
- @tek - reviewer for built-in/v0.x bugfix, new features
303+
- @tribbloid - reviewer for v1.x bugfix
304+
- @dwijnand - reviewer for scala compiler integration
305+

0 commit comments

Comments
 (0)