File tree Expand file tree Collapse file tree 3 files changed +19
-4
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 3 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -190,7 +190,8 @@ object NameOps {
190190
191191 /** Do two target names match? An empty target name matchws any other name. */
192192 def matchesTargetName (other : Name ) =
193- name == other || name.isEmpty || other.isEmpty
193+ name.isEmpty || other.isEmpty
194+ || name.isTermName == other.isTermName && name.toSimpleName == other.toSimpleName
194195
195196 private def functionSuffixStart : Int =
196197 val first = name.firstPart
Original file line number Diff line number Diff line change @@ -1342,11 +1342,12 @@ trait Checking {
13421342
13431343 /** Check that class does not declare same symbol twice */
13441344 def checkNoDoubleDeclaration (cls : Symbol )(using Context ): Unit =
1345- val seen = new mutable.HashMap [Name , List [Symbol ]].withDefaultValue(Nil )
1345+ val seen = new mutable.HashMap [String , List [Symbol ]].withDefaultValue(Nil )
13461346 typr.println(i " check no double declarations $cls" )
13471347
13481348 def checkDecl (decl : Symbol ): Unit =
1349- for other <- seen(decl.name) if decl.name != nme.ERROR && ! decl.isAbsent() && ! other.isAbsent() do
1349+ val key = decl.name.toString
1350+ for other <- seen(key) if decl.name != nme.ERROR && ! decl.isAbsent() && ! other.isAbsent() do
13501351 typr.println(i " conflict? $decl $other" )
13511352 def javaFieldMethodPair =
13521353 decl.is(JavaDefined ) && other.is(JavaDefined ) &&
@@ -1363,7 +1364,7 @@ trait Checking {
13631364 report.error(em " two or more overloaded variants of $decl have default arguments " , decl.srcPos)
13641365 decl.resetFlag(HasDefaultParams )
13651366 if ! excludeFromDoubleDeclCheck(decl) then
1366- seen(decl.name) = decl :: seen( decl.name)
1367+ seen(key) ::= decl
13671368
13681369 cls.info.decls.foreach(checkDecl)
13691370 cls.info match
Original file line number Diff line number Diff line change 1+ import annotation .*
2+
3+ case class StaticBinding (v : String ) {
4+ private def copy$default$1 (): String = ??? // error
5+ }
6+
7+ case class DynamicBinding (v : String ):
8+ @ targetName(" copy$default$1" )
9+ private def dynamo (): String = ??? // TODO
10+
11+ @ main def Demo =
12+ val b = StaticBinding (" test" )
13+ println(b)
You can’t perform that action at this time.
0 commit comments