Skip to content

Commit 7b34b90

Browse files
committed
Fix default args remove double errors
1 parent 54039f7 commit 7b34b90

File tree

5 files changed

+2
-12
lines changed

5 files changed

+2
-12
lines changed

library/src/scala/annotation/newMain.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ final class newMain extends MainAnnotation[FromString, Any]:
190190
if positionalArgs.length > 0 then
191191
List(positionalArgs.dequeue())
192192
else if paramInfo.hasDefault then
193-
Nil
193+
List("")
194194
else
195195
error(s"missing argument for ${paramInfo.name}")
196196
Nil

tests/run/main-annotation-help-override.check

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ Usage: helpOverride3 [-h] <Int>
1111
A method that should let --help display help, but not -h.
1212
Arguments:
1313
-h - Int
14-
Error: invalid argument for help: --help
1514
Error: missing argument for h
1615
Usage: helpOverride4 [--help] <Int> [-h] <Int>
1716
Error: invalid argument for notHelp: --help
@@ -21,7 +20,6 @@ Usage: helpOverride6 [--notHelp | -h] <Int>
2120
A method that should let --help display help, but not -h.
2221
Arguments:
2322
--notHelp (-h) - Int
24-
Error: invalid argument for notHelp: --help
2523
Error: missing argument for notH
2624
Usage: helpOverride7 [--notHelp | --help] <Int> [--notH | -h] <Int>
2725
Error: invalid argument for notHelp: --help
@@ -39,7 +37,6 @@ Arguments:
3937
--help - Int
4038
Error: invalid argument for h: -h
4139
Usage: helpOverride3 [-h] <Int>
42-
Error: invalid argument for help: -h
4340
Error: missing argument for h
4441
Usage: helpOverride4 [--help] <Int> [-h] <Int>
4542
Usage: helpOverride5 [--notHelp | --help] <Int>
@@ -49,7 +46,6 @@ Arguments:
4946
--notHelp (--help) - Int
5047
Error: invalid argument for notHelp: -h
5148
Usage: helpOverride6 [--notHelp | -h] <Int>
52-
Error: invalid argument for notHelp: -h
5349
Error: missing argument for notH
5450
Usage: helpOverride7 [--notHelp | --help] <Int> [--notH | -h] <Int>
5551
Error: invalid argument for notHelp: -h

tests/run/main-annotation-homemade-annot-1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import scala.concurrent._
2-
import scala.annotation.MainAnnotation
2+
import scala.annotation.*
33
import scala.collection.mutable
44
import ExecutionContext.Implicits.global
55
import duration._
Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
1-
Error: invalid argument for inc: true
21
Error: unused argument: SPAAAAACE
32
Usage: add [--num] <Int> [--inc] <Int>
4-
Error: invalid argument for num: add
53
Error: unused argument: 3
64
Usage: add [--num] <Int> [--inc] <Int>
7-
Error: invalid argument for num: true
8-
Error: invalid argument for inc: false
95
Error: unused argument: 10
106
Usage: add [--num] <Int> [--inc] <Int>
11-
Error: invalid argument for num: binary
127
Error: unused argument: 01
138
Usage: add [--num] <Int> [--inc] <Int>

tests/run/main-annotation-wrong-param-names.check

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ Error: missing argument for inc
33
Error: unknown argument name: --n
44
Error: unknown argument name: --i
55
Usage: add [--num] <Int> [--inc] <Int>
6-
Error: invalid argument for num: num
76
Error: unused argument: inc
87
Error: unused argument: 10
98
Usage: add [--num] <Int> [--inc] <Int>

0 commit comments

Comments
 (0)