Skip to content

Commit 09d9a24

Browse files
committed
Review fixes pt. 2
1 parent 67711fe commit 09d9a24

File tree

8 files changed

+15
-15
lines changed

8 files changed

+15
-15
lines changed

compiler/src/dotty/tools/dotc/typer/Synthesizer.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ class Synthesizer(typer: Typer)(using @constructorOnly c: Context):
327327
val reason = if !cls.isGenericProduct then
328328
i"because ${cls.whyNotGenericProduct}"
329329
else if !canAccessCtor(cls) then
330-
i"because constructor of $cls is unnaccessible from the calling scope."
330+
i"because the constructor of $cls is innaccessible from the calling scope."
331331
else
332332
""
333333
i"$cls is not a generic product $reason"
@@ -618,7 +618,7 @@ object Synthesizer:
618618
private def orElse(treeWithErrors1: TreeWithErrors, treeWithErrors2: => TreeWithErrors): TreeWithErrors = treeWithErrors1 match
619619
case (tree, errors) if tree eq genericEmptyTree =>
620620
val (tree2, errors2) = treeWithErrors2
621-
(tree2, errors2 ::: errors)
621+
(tree2, errors ::: errors2)
622622
case _ => treeWithErrors1
623623

624624
private def clearErrorsIfNotEmpty(treeWithErrors: TreeWithErrors) = treeWithErrors match

tests/neg/i14432.check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
13 |val mFoo = summon[Mirror.Of[Foo]] // error: no mirror found
33
| ^
44
|No given instance of type deriving.Mirror.Of[example.Foo] was found for parameter x of method summon in object Predef. Failed to synthesize an instance of type deriving.Mirror.Of[example.Foo]:
5+
| * class Foo is not a generic product because the constructor of class Foo is innaccessible from the calling scope.
56
| * class Foo is not a generic sum because it is not a sealed class
6-
| * class Foo is not a generic product because constructor of class Foo is unnaccessible from the calling scope.

tests/neg/i14432a.check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
14 | val mFoo = summon[Mirror.Of[example.Foo]] // error: no mirror found
33
| ^
44
|No given instance of type deriving.Mirror.Of[example.Foo] was found for parameter x of method summon in object Predef. Failed to synthesize an instance of type deriving.Mirror.Of[example.Foo]:
5+
| * class Foo is not a generic product because the constructor of class Foo is innaccessible from the calling scope.
56
| * class Foo is not a generic sum because it is not a sealed class
6-
| * class Foo is not a generic product because constructor of class Foo is unnaccessible from the calling scope.

tests/neg/i14432b.check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
15 | val mFoo = summon[Mirror.Of[example.Foo]] // error: no mirror found
33
| ^
44
|No given instance of type deriving.Mirror.Of[example.Foo] was found for parameter x of method summon in object Predef. Failed to synthesize an instance of type deriving.Mirror.Of[example.Foo]:
5+
| * class Foo is not a generic product because the constructor of class Foo is innaccessible from the calling scope.
56
| * class Foo is not a generic sum because it is not a sealed class
6-
| * class Foo is not a generic product because constructor of class Foo is unnaccessible from the calling scope.

tests/neg/i14432c.check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010
16 | val mFoo = summon[Mirror.Of[example.Foo]] // error: no mirror
1111
| ^
1212
|No given instance of type deriving.Mirror.Of[example.Foo] was found for parameter x of method summon in object Predef. Failed to synthesize an instance of type deriving.Mirror.Of[example.Foo]:
13+
| * class Foo is not a generic product because the constructor of class Foo is innaccessible from the calling scope.
1314
| * class Foo is not a generic sum because it is not a sealed class
14-
| * class Foo is not a generic product because constructor of class Foo is unnaccessible from the calling scope.

tests/neg/i14432d.check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
17 | val mFoo = summon[Mirror.Of[example.Foo]] // error
33
| ^
44
|No given instance of type deriving.Mirror.Of[example.Foo] was found for parameter x of method summon in object Predef. Failed to synthesize an instance of type deriving.Mirror.Of[example.Foo]:
5+
| * class Foo is not a generic product because the constructor of class Foo is innaccessible from the calling scope.
56
| * class Foo is not a generic sum because it is not a sealed class
6-
| * class Foo is not a generic product because constructor of class Foo is unnaccessible from the calling scope.

tests/neg/i14823.check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
8 |val baz = summon[Mirror.Of[SubA[Int] | SubB[Int]]] // error
33
| ^
44
|No given instance of type deriving.Mirror.Of[SubA[Int] | SubB[Int]] was found for parameter x of method summon in object Predef. Failed to synthesize an instance of type deriving.Mirror.Of[SubA[Int] | SubB[Int]]:
5-
| * class Cov is not a generic sum because it is not a sealed class
65
| * class Cov is not a generic product
6+
| * class Cov is not a generic sum because it is not a sealed class

tests/neg/mirror-synthesis-errors.check

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,41 @@
22
21 |val testA = summon[Mirror.Of[A]] // error: Not a sealed trait
33
| ^
44
|No given instance of type deriving.Mirror.Of[A] was found for parameter x of method summon in object Predef. Failed to synthesize an instance of type deriving.Mirror.Of[A]:
5-
| * trait A is not a generic sum because it is not a sealed trait
65
| * trait A is not a generic product because it is not a case class
6+
| * trait A is not a generic sum because it is not a sealed trait
77
-- Error: tests/neg/mirror-synthesis-errors.scala:22:32 ----------------------------------------------------------------
88
22 |val testC = summon[Mirror.Of[C]] // error: Does not have subclasses
99
| ^
1010
|No given instance of type deriving.Mirror.Of[C] was found for parameter x of method summon in object Predef. Failed to synthesize an instance of type deriving.Mirror.Of[C]:
11-
| * trait C is not a generic sum because it does not have subclasses
1211
| * trait C is not a generic product because it is not a case class
12+
| * trait C is not a generic sum because it does not have subclasses
1313
-- Error: tests/neg/mirror-synthesis-errors.scala:23:32 ----------------------------------------------------------------
1414
23 |val testD = summon[Mirror.Of[D]] // error: child SubD takes more than one parameter list
1515
| ^
1616
|No given instance of type deriving.Mirror.Of[D] was found for parameter x of method summon in object Predef. Failed to synthesize an instance of type deriving.Mirror.Of[D]:
17-
| * class D is not a generic sum because its child class SubD is not a generic product because it takes more than one parameter list
1817
| * class D is not a generic product because it is not a case class
18+
| * class D is not a generic sum because its child class SubD is not a generic product because it takes more than one parameter list
1919
-- Error: tests/neg/mirror-synthesis-errors.scala:24:38 ----------------------------------------------------------------
2020
24 |val testSubD = summon[Mirror.Of[SubD]] // error: takes more than one parameter list
2121
| ^
2222
|No given instance of type deriving.Mirror.Of[SubD] was found for parameter x of method summon in object Predef. Failed to synthesize an instance of type deriving.Mirror.Of[SubD]:
23-
| * class SubD is not a generic sum because it is not a sealed class
2423
| * class SubD is not a generic product because it takes more than one parameter list
24+
| * class SubD is not a generic sum because it is not a sealed class
2525
-- Error: tests/neg/mirror-synthesis-errors.scala:25:32 ----------------------------------------------------------------
2626
25 |val testE = summon[Mirror.Of[E]] // error: Not an abstract class
2727
| ^
2828
|No given instance of type deriving.Mirror.Of[E] was found for parameter x of method summon in object Predef. Failed to synthesize an instance of type deriving.Mirror.Of[E]:
29-
| * class E is not a generic sum because it is not an abstract class
3029
| * class E is not a generic product because it is not a case class
30+
| * class E is not a generic sum because it is not an abstract class
3131
-- Error: tests/neg/mirror-synthesis-errors.scala:26:32 ----------------------------------------------------------------
3232
26 |val testF = summon[Mirror.Of[F]] // error: No children
3333
| ^
3434
|No given instance of type deriving.Mirror.Of[F] was found for parameter x of method summon in object Predef. Failed to synthesize an instance of type deriving.Mirror.Of[F]:
35-
| * trait F is not a generic sum because it does not have subclasses
3635
| * trait F is not a generic product because it is not a case class
36+
| * trait F is not a generic sum because it does not have subclasses
3737
-- Error: tests/neg/mirror-synthesis-errors.scala:27:36 ----------------------------------------------------------------
3838
27 |val testG = summon[Mirror.Of[Foo.G]] // error: Has anonymous subclasses
3939
| ^
4040
|No given instance of type deriving.Mirror.Of[Foo.G] was found for parameter x of method summon in object Predef. Failed to synthesize an instance of type deriving.Mirror.Of[Foo.G]:
41-
| * trait G is not a generic sum because it has anonymous or inaccessible subclasses
4241
| * trait G is not a generic product because it is not a case class
42+
| * trait G is not a generic sum because it has anonymous or inaccessible subclasses

0 commit comments

Comments
 (0)