Skip to content

Commit aa8303c

Browse files
TheElectronWillsmarter
authored andcommitted
Fix record's constructor
Co-authored-by: Guillaume Martres <[email protected]>
1 parent bb515cc commit aa8303c

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

compiler/src/dotty/tools/dotc/parsing/JavaParsers.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,8 @@ object JavaParsers {
854854
).toList
855855

856856
// generate the canonical constructor
857-
val canonicalConstructor = makeConstructor(header, tparams)
857+
val canonicalConstructor =
858+
DefDef(nme.CONSTRUCTOR, joinParams(tparams, List(header)), TypeTree(), EmptyTree).withMods(Modifiers(Flags.JavaDefined, mods.privateWithin))
858859

859860
// return the trees
860861
val recordTypeDef = atSpan(start, nameOffset) {
@@ -863,7 +864,7 @@ object JavaParsers {
863864
parents = superclass :: interfaces,
864865
stats = canonicalConstructor :: accessors ::: body,
865866
tparams = tparams,
866-
false
867+
true
867868
)
868869
)
869870
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3598,7 +3598,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
35983598
adapt(tree, pt, ctx.typerState.ownedVars)
35993599

36003600
private def adapt1(tree: Tree, pt: Type, locked: TypeVars)(using Context): Tree = {
3601-
assert(pt.exists && !pt.isInstanceOf[ExprType] || ctx.reporter.errorsReported)
3601+
assert(pt.exists && !pt.isInstanceOf[ExprType] || ctx.reporter.errorsReported, i"tree: $tree, pt: $pt")
36023602
def methodStr = err.refStr(methPart(tree).tpe)
36033603

36043604
def readapt(tree: Tree)(using Context) = adapt(tree, pt, locked)

0 commit comments

Comments
 (0)