File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -702,7 +702,11 @@ func run(
702702 continue
703703 }
704704 shortName := parts [1 ]
705- if _ , ok := typeByShortName [shortName ]; ! ok {
705+ if existing , ok := typeByShortName [shortName ]; ok {
706+ if existing != key {
707+ typeByShortName [shortName ] = "" // ambiguous
708+ }
709+ } else {
706710 typeByShortName [shortName ] = key
707711 }
708712 }
@@ -1235,6 +1239,20 @@ func resolveTypeKey(
12351239 }
12361240 }
12371241 }
1242+ for key := range knownInterfaceGoTypes {
1243+ parts := strings .SplitN (key , ":" , 2 )
1244+ if len (parts ) == 2 && parts [1 ] == bare {
1245+ prefix := commonPrefixLen (ifaceImportPath , parts [0 ])
1246+ depth := strings .Count (parts [0 ], "/" ) + 1
1247+ if prefix > bestPrefix ||
1248+ (prefix == bestPrefix && depth < bestDepth ) ||
1249+ (prefix == bestPrefix && depth == bestDepth && key < bestKey ) {
1250+ bestPrefix = prefix
1251+ bestDepth = depth
1252+ bestKey = key
1253+ }
1254+ }
1255+ }
12381256 if bestKey != "" {
12391257 return bestKey
12401258 }
Original file line number Diff line number Diff line change @@ -818,7 +818,7 @@ func tryParseTernaryExpr(
818818 }
819819
820820 rest := value [qIdx + 3 :]
821- cIdx := strings . Index (rest , " : " )
821+ cIdx := lastIndexAtDepthZero (rest , " : " )
822822 if cIdx < 0 {
823823 return nil
824824 }
@@ -1035,7 +1035,7 @@ func generateAccessorFiles(
10351035// IFoo -> FooProxy, Foo -> FooProxy. This mirrors the codegen convention.
10361036func deriveProxyName (interfaceName string ) string {
10371037 base := interfaceName
1038- if strings . HasPrefix (interfaceName , "I" ) && len ( interfaceName ) > 1 {
1038+ if len (interfaceName ) >= 2 && interfaceName [ 0 ] == 'I' && interfaceName [ 1 ] >= 'A' && interfaceName [ 1 ] <= 'Z' {
10391039 base = interfaceName [1 :]
10401040 }
10411041 return base + "Proxy"
You can’t perform that action at this time.
0 commit comments