Repository: apple/pkl
File: pkl-doc/src/main/kotlin/org/pkl/doc/DocPackageInfo.kt (Kotlin)

Code before:
    }
    for (dependency in dependencies) {
      if (moduleName.startsWith(dependency.prefix)) {
        return TypeRef(
          dependency.name,
          dependency.uri,
          dependency.version,
          getModulePath(moduleName, dependency.prefix),
          type.simpleName,
          isTypeAlias = type is TypeAlias
        )
      }
    }
    return null
  }

  internal fun getModuleImportUri(moduleName: String): URI =
    when (importUri) {
      "pkl:/" -> "pkl:${moduleName.substring(4)}".toUri()
      else -> {
        val path = getModulePath(moduleName, moduleNamePrefix).uriEncoded + ".pkl"
        URI(importUri).resolve(path)
      }
    }

  internal fun getModuleSourceCode(moduleName: String): URI? {
    val path = "/" + getModulePath(moduleName, moduleNamePrefix).uriEncoded + ".pkl"
    // assumption: the fragment is only used for line numbers
    return sourceCodeUrlScheme?.replace("%{path}", path)?.substringBefore('#')?.let(URI::create)
  }

  /** Information about a depended-on package. */
  data class PackageDependency(
    /** The name of the depended-on package. */
    val name: String,

    /** The URI of the dependend-upon package, if any. */
    val uri: @Contextual URI?,

    /** The version of the depended-on package. */
    val version: String,

    /**
     * The web URL of the source code for the depended-on package *version*. Must end with a slash.
     */
    val sourceCode: @Contextual URI?,

    /** The source URL scheme of the depended-upon package _version_, with placeholders. */
    val sourceCodeUrlScheme: String?,

    /**

Review comment (suggestion):
We can actually just use `URI(importUri + path)` in all cases.

Looks like I was the one that broke this logic in [an earlier PR](https://github.com/apple/pkl/commit/dddae1190febb148821a8560ffafbbba7dba413a#diff-08d9462f05ae0598bb1e90c634ccf7295edb7119c9bfc29d4a83fe93c9bd0ca9R162-R169)

```suggestion
        URI(importUri + path)
```


Code after:
    }
    for (dependency in dependencies) {
      if (moduleName.startsWith(dependency.prefix)) {
        return TypeRef(
          dependency.name,
          dependency.uri,
          dependency.version,
          getModulePath(moduleName, dependency.prefix),
          type.simpleName,
          isTypeAlias = type is TypeAlias
        )
      }
    }
    return null
  }

  internal fun getModuleImportUri(moduleName: String): URI =
    when (importUri) {
      "pkl:/" -> "pkl:${moduleName.substring(4)}".toUri()
      else -> {
        val path = getModulePath(moduleName, moduleNamePrefix).uriEncoded + ".pkl"
        URI(importUri + path)
      }
    }

  internal fun getModuleSourceCode(moduleName: String): URI? {
    val path = "/" + getModulePath(moduleName, moduleNamePrefix).uriEncoded + ".pkl"
    // assumption: the fragment is only used for line numbers
    return sourceCodeUrlScheme?.replace("%{path}", path)?.substringBefore('#')?.let(URI::create)
  }

  /** Information about a depended-on package. */
  data class PackageDependency(
    /** The name of the depended-on package. */
    val name: String,

    /** The URI of the dependend-upon package, if any. */
    val uri: @Contextual URI?,

    /** The version of the depended-on package. */
    val version: String,

    /**
     * The web URL of the source code for the depended-on package *version*. Must end with a slash.
     */
    val sourceCode: @Contextual URI?,

    /** The source URL scheme of the depended-upon package _version_, with placeholders. */
    val sourceCodeUrlScheme: String?,

    /**