Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/pip/gh-pages/mkdocs-material-appr…
Browse files Browse the repository at this point in the history
…ox-eq-7.0.6
  • Loading branch information
iliapolo committed Mar 17, 2021
2 parents 7cad510 + 097a4ea commit e4c74df
Show file tree
Hide file tree
Showing 28 changed files with 1,723 additions and 280 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,23 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [1.25.0](https://github.com/aws/jsii/compare/v1.24.0...v1.25.0) (2021-03-16)


### Features

* **compliance:** Compliance suite ([#2607](https://github.com/aws/jsii/issues/2607)) ([18b2c16](https://github.com/aws/jsii/commit/18b2c167bbc47d7620e6a952e08751af28bf53a6))
* **go:** packageName and versionSuffix ([#2687](https://github.com/aws/jsii/issues/2687)) ([9562108](https://github.com/aws/jsii/commit/95621082cb742bb8dc24e28f3bf6cb6013050c03)), closes [#2632](https://github.com/aws/jsii/issues/2632)


### Bug Fixes

* **go:** duplicate conversion functions when parent structs have the same base name ([#2697](https://github.com/aws/jsii/issues/2697)) ([52bd510](https://github.com/aws/jsii/commit/52bd510a994597cc166effde0b8c658a2a8cb0df)), closes [#2692](https://github.com/aws/jsii/issues/2692)
* **go:** invalid code when a module only has static methods [test only] ([#2704](https://github.com/aws/jsii/issues/2704)) ([2dbe84d](https://github.com/aws/jsii/commit/2dbe84dfeff8d6f63aab19c1674fb7c9d17ea976)), closes [#2622](https://github.com/aws/jsii/issues/2622) [#2617](https://github.com/aws/jsii/issues/2617)
* **go:** missing imports needed by base members ([#2685](https://github.com/aws/jsii/issues/2685)) ([daca06f](https://github.com/aws/jsii/commit/daca06f7c426d1fba509068ab842bd8dc7ddb62a)), closes [#2647](https://github.com/aws/jsii/issues/2647)
* **go:** missing imports required by collection types ([#2691](https://github.com/aws/jsii/issues/2691)) ([c9a36a6](https://github.com/aws/jsii/commit/c9a36a6c0e18c44aa8e8e7e719cb9df144da5193)), closes [#2689](https://github.com/aws/jsii/issues/2689)
* **go:** nested types are not namespaced ([#2650](https://github.com/aws/jsii/issues/2650)) ([45b527c](https://github.com/aws/jsii/commit/45b527c0b2f35a09b715c1a6c5940ec0578007fb)), closes [#2649](https://github.com/aws/jsii/issues/2649)

## [1.24.0](https://github.com/aws/jsii/compare/v1.23.0...v1.24.0) (2021-03-03)


Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Expand Up @@ -10,5 +10,5 @@
"rejectCycles": true
}
},
"version": "1.24.0"
"version": "1.25.0"
}
Expand Up @@ -13,7 +13,7 @@ const embeddedRootDir string = "resources"
var embeddedFS embed.FS

// entrypointName is the path to the entry point relative to the embeddedRootDir.
var entrypointName string = path.Join("bin", "jsii-runtime.js")
var entrypointName = path.Join("bin", "jsii-runtime.js")

// ExtractRuntime extracts a copy of the embedded runtime library into
// the designated directory, and returns the fully qualified path to the entry
Expand Down
Expand Up @@ -131,7 +131,7 @@ func canonicalValue(value reflect.Value) (reflect.Value, error) {
// a nil value, or a value that is not ultimately a reflect.Struct may result
// in panic.
func findAliases(value reflect.Value) []reflect.Value {
result := []reflect.Value{}
var result []reflect.Value

// Indirect so we always work on the pointer referree
value = reflect.Indirect(value)
Expand Down
Expand Up @@ -44,7 +44,8 @@ func (t *TypeRegistry) RegisterClass(fqn api.FQN, class reflect.Type, overrides

// Skipping registration if there are no members, as this would have no use.
if len(overrides) > 0 {
t.typeMembers[fqn] = append([]api.Override{}, overrides...)
t.typeMembers[fqn] = make([]api.Override, len(overrides))
copy(t.typeMembers[fqn], overrides)
}

return nil
Expand Down Expand Up @@ -100,7 +101,8 @@ func (t *TypeRegistry) RegisterInterface(fqn api.FQN, iface reflect.Type, overri

// Skipping registration if there are no members, as this would have no use.
if len(overrides) > 0 {
t.typeMembers[fqn] = append([]api.Override{}, overrides...)
t.typeMembers[fqn] = make([]api.Override, len(overrides))
copy(t.typeMembers[fqn], overrides)
}

return nil
Expand All @@ -118,8 +120,12 @@ func (t *TypeRegistry) RegisterStruct(fqn api.FQN, strct reflect.Type) error {
return fmt.Errorf("another type was already registered with %s: %v", fqn, existing)
}

fields := []reflect.StructField{}
if existing, exists := t.structInfo[strct]; exists && existing.FQN != fqn {
return fmt.Errorf("attempting to register type %s as %s, but it was already registered as: %s", strct.String(), fqn, existing.FQN)
}

numField := strct.NumField()
fields := make([]reflect.StructField, 0, numField)
for i := 0; i < numField; i++ {
field := strct.Field(i)
if field.Anonymous {
Expand Down
Expand Up @@ -57,8 +57,10 @@ func (t *TypeRegistry) StructFields(typ reflect.Type) (fields []reflect.StructFi
if info, ok = t.structInfo[typ]; !ok {
return
}

fqn = info.FQN
fields = append(fields, info.Fields...)
fields = make([]reflect.StructField, len(info.Fields))
copy(fields, info.Fields)
return
}

Expand Down
12 changes: 6 additions & 6 deletions packages/@jsii/go-runtime/jsii-runtime-go/runtime.go
Expand Up @@ -61,7 +61,7 @@ func RegisterClass(fqn FQN, class reflect.Type, members []Member, maker func() i

// RegisterEnum associates an enum's fully qualified name to the specified enum
// type, and members. Panics if enum is not a reflect.String type, any value in
// the provided members map is of a type ofther than enum, or if the provided
// the provided members map is of a type other than enum, or if the provided
// fqn was already used to register a different type.
func RegisterEnum(fqn FQN, enum reflect.Type, members map[string]interface{}) {
client := kernel.GetClient()
Expand Down Expand Up @@ -141,9 +141,9 @@ func Create(fqn FQN, args []interface{}, interfaces []FQN, overriddenMembers []M
}
}

var interfaceFQNs []api.FQN
for _, iface := range interfaces {
interfaceFQNs = append(interfaceFQNs, api.FQN(iface))
interfaceFQNs := make([]api.FQN, len(interfaces))
for i, iface := range interfaces {
interfaceFQNs[i] = api.FQN(iface)
}
overrides := make([]api.Override, len(overriddenMembers))
for i, member := range overriddenMembers {
Expand Down Expand Up @@ -336,10 +336,10 @@ func StaticSet(fqn FQN, property string, value interface{}) {
// ready for inclusion in an invoke or create request.
func convertArguments(args []interface{}) []interface{} {
if len(args) == 0 {
return make([]interface{}, 0, 0)
return nil
}

result := make([]interface{}, len(args), len(args))
result := make([]interface{}, len(args))
client := kernel.GetClient()
for i, arg := range args {
val := reflect.ValueOf(arg)
Expand Down
2 changes: 1 addition & 1 deletion packages/@jsii/python-runtime/requirements.txt
Expand Up @@ -3,7 +3,7 @@ mypy==0.812
pip~=21.0
pytest~=6.2
pytest-mypy~=0.8
setuptools~=54.0
setuptools~=54.1
wheel~=0.36

-e .
15 changes: 12 additions & 3 deletions packages/@jsii/spec/lib/assembly.ts
Expand Up @@ -783,9 +783,18 @@ export interface TypeBase extends Documentable, SourceLocatable {
assembly: string;

/**
* The namespace of the type (``foo.bar.baz``). When undefined, the type is located at the root of the assembly
* (it's ``fqn`` would be like ``<assembly>.<name>``). If the `namespace` corresponds to an existing type's
* namespace-qualified (e.g: ``<namespace>.<name>``), then the current type is a nested type.
* The namespace of the type (`foo.bar.baz`).
*
* When undefined, the type is located at the root of the assembly (its
* `fqn` would be like `<assembly>.<name>`).
*
* For types inside other types or inside submodules, the `<namespace>` corresponds to
* the namespace-qualified name of the container (can contain multiple segments like:
* `<ns1>.<ns2>.<ns3>`).
*
* In all cases:
*
* <fqn> = <assembly>[.<namespace>].<name>
*
* @default none
*/
Expand Down
1 change: 1 addition & 0 deletions packages/jsii-calc/lib/index.ts
Expand Up @@ -14,6 +14,7 @@ export * as nodirect from './no-direct-types';
export * as module2647 from './module2647';
export * as module2617 from './module2617';
export * as module2689 from './module2689';
export * as module2702 from './module2702';
export * as module2692 from './module2692';
export * as module2530 from './module2530';
export * as module2700 from './module2700';
32 changes: 32 additions & 0 deletions packages/jsii-calc/lib/module2702/index.ts
@@ -0,0 +1,32 @@
// member has the same name as a base class
// @see https://github.com/aws/jsii/issues/2702

import { Base, IBaseInterface } from '@scope/jsii-calc-base';

export class Class1 extends Base {
public base() {
return;
}
}

export class Class2 extends Base {
public readonly base = 'hello';
}

export class Class3 implements IBaseInterface {
public bar(): void {
return;
}

public foo(): void {
return;
}

public iBaseInterface() {
return;
}
}

export interface IFoo extends IBaseInterface {
readonly iBaseInterface: string;
}
164 changes: 160 additions & 4 deletions packages/jsii-calc/test/assembly.jsii
Expand Up @@ -214,7 +214,7 @@
"jsii-calc.module2530": {
"locationInModule": {
"filename": "lib/index.ts",
"line": 18
"line": 19
}
},
"jsii-calc.module2617": {
Expand Down Expand Up @@ -262,7 +262,7 @@
"jsii-calc.module2692": {
"locationInModule": {
"filename": "lib/index.ts",
"line": 17
"line": 18
}
},
"jsii-calc.module2692.submodule1": {
Expand All @@ -280,7 +280,13 @@
"jsii-calc.module2700": {
"locationInModule": {
"filename": "lib/index.ts",
"line": 19
"line": 20
}
},
"jsii-calc.module2702": {
"locationInModule": {
"filename": "lib/index.ts",
"line": 17
}
},
"jsii-calc.nodirect": {
Expand Down Expand Up @@ -14962,6 +14968,156 @@
}
]
},
"jsii-calc.module2702.Class1": {
"assembly": "jsii-calc",
"base": "@scope/jsii-calc-base.Base",
"docs": {
"stability": "stable"
},
"fqn": "jsii-calc.module2702.Class1",
"initializer": {},
"kind": "class",
"locationInModule": {
"filename": "lib/module2702/index.ts",
"line": 6
},
"methods": [
{
"docs": {
"stability": "stable"
},
"locationInModule": {
"filename": "lib/module2702/index.ts",
"line": 7
},
"name": "base"
}
],
"name": "Class1",
"namespace": "module2702"
},
"jsii-calc.module2702.Class2": {
"assembly": "jsii-calc",
"base": "@scope/jsii-calc-base.Base",
"docs": {
"stability": "stable"
},
"fqn": "jsii-calc.module2702.Class2",
"initializer": {},
"kind": "class",
"locationInModule": {
"filename": "lib/module2702/index.ts",
"line": 12
},
"name": "Class2",
"namespace": "module2702",
"properties": [
{
"docs": {
"stability": "stable"
},
"immutable": true,
"locationInModule": {
"filename": "lib/module2702/index.ts",
"line": 13
},
"name": "base",
"type": {
"primitive": "string"
}
}
]
},
"jsii-calc.module2702.Class3": {
"assembly": "jsii-calc",
"docs": {
"stability": "stable"
},
"fqn": "jsii-calc.module2702.Class3",
"initializer": {
"docs": {
"stability": "stable"
}
},
"interfaces": [
"@scope/jsii-calc-base.IBaseInterface"
],
"kind": "class",
"locationInModule": {
"filename": "lib/module2702/index.ts",
"line": 16
},
"methods": [
{
"docs": {
"stability": "stable"
},
"locationInModule": {
"filename": "lib/module2702/index.ts",
"line": 17
},
"name": "bar",
"overrides": "@scope/jsii-calc-base.IBaseInterface"
},
{
"docs": {
"stability": "stable"
},
"locationInModule": {
"filename": "lib/module2702/index.ts",
"line": 21
},
"name": "foo",
"overrides": "@scope/jsii-calc-base-of-base.IVeryBaseInterface"
},
{
"docs": {
"stability": "stable"
},
"locationInModule": {
"filename": "lib/module2702/index.ts",
"line": 25
},
"name": "iBaseInterface"
}
],
"name": "Class3",
"namespace": "module2702"
},
"jsii-calc.module2702.IFoo": {
"assembly": "jsii-calc",
"docs": {
"stability": "stable"
},
"fqn": "jsii-calc.module2702.IFoo",
"interfaces": [
"@scope/jsii-calc-base.IBaseInterface"
],
"kind": "interface",
"locationInModule": {
"filename": "lib/module2702/index.ts",
"line": 30
},
"name": "IFoo",
"namespace": "module2702",
"properties": [
{
"abstract": true,
"docs": {
"stability": "stable"
},
"immutable": true,
"locationInModule": {
"filename": "lib/module2702/index.ts",
"line": 31
},
"name": "iBaseInterface",
"type": {
"primitive": "string"
}
}
]
},
"jsii-calc.nodirect.sub1.TypeFromSub1": {
"assembly": "jsii-calc",
"docs": {
Expand Down Expand Up @@ -15718,5 +15874,5 @@
}
},
"version": "3.20.120",
"fingerprint": "0UwgWtQxMTELv9VFLdPFtg1Zv/tSVnARqKIjCAhYAgg="
"fingerprint": "qsiNdf02KvRlGy6cULMMyEknbuVVEoKtzWVsTGz72OA="
}

0 comments on commit e4c74df

Please sign in to comment.