Properly handle 'void' return type when checking signature compatibility

This commit is contained in:
dcodeIO 2018-03-21 01:16:46 +01:00
parent 477669d7a3
commit 8c1847b316
8 changed files with 62 additions and 23 deletions

2
dist/asc.js vendored

File diff suppressed because one or more lines are too long

2
dist/asc.js.map vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -2978,22 +2978,14 @@ export class ClassPrototype extends Element {
internalName + INSTANCE_DELIMITER + member.simpleName,
this
);
let partialGetterPrototype = (
(<FunctionPrototype>(<Property>member).getterPrototype).resolvePartial(
typeArguments
)
);
let partialGetterPrototype = getterPrototype.resolvePartial(typeArguments);
if (!partialGetterPrototype) return null;
partialGetterPrototype.internalName = (
internalName + INSTANCE_DELIMITER + partialGetterPrototype.simpleName
);
instanceProperty.getterPrototype = partialGetterPrototype;
if (setterPrototype) {
let partialSetterPrototype = (
(<FunctionPrototype>(<Property>member).setterPrototype).resolvePartial(
typeArguments
)
);
let partialSetterPrototype = setterPrototype.resolvePartial(typeArguments);
if (!partialSetterPrototype) return null;
partialSetterPrototype.internalName = (
internalName + INSTANCE_DELIMITER + partialSetterPrototype.simpleName
@ -3003,10 +2995,7 @@ export class ClassPrototype extends Element {
instance.members.set(member.simpleName, instanceProperty);
break;
}
default: {
assert(false);
break;
}
default: assert(false);
}
}
}

View File

@ -539,7 +539,9 @@ export class Signature {
}
// check return type
return this.returnType.isAssignableTo(target.returnType);
var thisReturnType = this.returnType;
var targetReturnType = target.returnType;
return thisReturnType == targetReturnType || this.returnType.isAssignableTo(target.returnType);
}
/** Converts this signature to a function type string. */

30
std/assembly.d.ts vendored
View File

@ -35,75 +35,99 @@ declare type f64 = number;
/** Converts any other numeric value to an 8-bit signed integer. */
declare function i8(value: i8 | i16 | i32 | i64 | isize | u8 | u16 | u32 | u64 | usize | bool | f32 | f64): i8;
declare namespace i8 {
/** Smallest representable value. */
export const MIN_VALUE: i8;
/** Largest representable value. */
export const MAX_VALUE: i8;
}
/** Converts any other numeric value to a 16-bit signed integer. */
declare function i16(value: i8 | i16 | i32 | i64 | isize | u8 | u16 | u32 | u64 | usize | bool | f32 | f64): i8;
declare namespace i16 {
/** Smallest representable value. */
export const MIN_VALUE: i16;
/** Largest representable value. */
export const MAX_VALUE: i16;
}
/** Converts any other numeric value to a 32-bit signed integer. */
declare function i32(value: i8 | i16 | i32 | i64 | isize | u8 | u16 | u32 | u64 | usize | bool | f32 | f64): i32;
declare namespace i32 {
/** Smallest representable value. */
export const MIN_VALUE: i32;
/** Largest representable value. */
export const MAX_VALUE: i32;
}
/** Converts any other numeric value to a 64-bit signed integer. */
declare function i64(value: i8 | i16 | i32 | i64 | isize | u8 | u16 | u32 | u64 | usize | bool | f32 | f64): i64;
declare namespace i64 {
/** Smallest representable value. */
export const MIN_VALUE: i64;
/** Largest representable value. */
export const MAX_VALUE: i64;
}
/** Converts any other numeric value to a 32-bit (in WASM32) respectivel 64-bit (in WASM64) signed integer. */
declare function isize(value: i8 | i16 | i32 | i64 | isize | u8 | u16 | u32 | u64 | usize | bool | f32 | f64): isize;
declare namespace isize {
/** Smallest representable value. */
export const MIN_VALUE: isize;
/** Largest representable value. */
export const MAX_VALUE: isize;
}
/** Converts any other numeric value to an 8-bit unsigned integer. */
declare function u8(value: i8 | i16 | i32 | i64 | isize | u8 | u16 | u32 | u64 | usize | bool | f32 | f64): i8;
declare namespace u8 {
/** Smallest representable value. */
export const MIN_VALUE: u8;
/** Largest representable value. */
export const MAX_VALUE: u8;
}
/** Converts any other numeric value to a 16-bit unsigned integer. */
declare function u16(value: i8 | i16 | i32 | i64 | isize | u8 | u16 | u32 | u64 | usize | bool | f32 | f64): i8;
declare namespace u16 {
/** Smallest representable value. */
export const MIN_VALUE: u16;
/** Largest representable value. */
export const MAX_VALUE: u16;
}
/** Converts any other numeric value to a 32-bit unsigned integer. */
declare function u32(value: i8 | i16 | i32 | i64 | isize | u8 | u16 | u32 | u64 | usize | bool | f32 | f64): i32;
declare namespace u32 {
/** Smallest representable value. */
export const MIN_VALUE: u32;
/** Largest representable value. */
export const MAX_VALUE: u32;
}
/** Converts any other numeric value to a 64-bit unsigned integer. */
declare function u64(value: i8 | i16 | i32 | i64 | isize | u8 | u16 | u32 | u64 | usize | bool | f32 | f64): i64;
declare namespace u64 {
/** Smallest representable value. */
export const MIN_VALUE: u64;
/** Largest representable value. */
export const MAX_VALUE: u64;
}
/** Converts any other numeric value to a 32-bit (in WASM32) respectivel 64-bit (in WASM64) unsigned integer. */
declare function usize(value: i8 | i16 | i32 | i64 | isize | u8 | u16 | u32 | u64 | usize | bool | f32 | f64): isize;
declare namespace usize {
/** Smallest representable value. */
export const MIN_VALUE: usize;
/** Largesst representable value. */
export const MAX_VALUE: usize;
}
/** Converts any other numeric value to a 1-bit unsigned integer. */
declare function bool(value: i8 | i16 | i32 | i64 | isize | u8 | u16 | u32 | u64 | usize | bool | f32 | f64): bool;
declare namespace bool {
/** Smallest representable value. */
export const MIN_VALUE: bool;
/** Largest representable value. */
export const MAX_VALUE: bool;
}
/** Converts any other numeric value to a 32-bit float. */
declare function f32(value: i8 | i16 | i32 | i64 | isize | u8 | u16 | u32 | u64 | usize | bool | f32 | f64): f32;
declare namespace f32 {
/** Smallest representable value. */
export const MIN_VALUE: f32;
/** Largest representable value. */
export const MAX_VALUE: f32;
/** Smallest normalized positive value */
/** Smallest normalized positive value. */
export const MIN_POSITIVE_VALUE: f32;
/** Smallest safely representable integer value. */
export const MIN_SAFE_INTEGER: f32;
@ -115,9 +139,11 @@ declare namespace f32 {
/** Converts any other numeric value to a 64-bit float. */
declare function f64(value: i8 | i16 | i32 | i64 | isize | u8 | u16 | u32 | u64 | usize | bool | f32 | f64): f64;
declare namespace f64 {
/** Smallest representable value. */
export const MIN_VALUE: f64;
/** Largest representable value. */
export const MAX_VALUE: f64;
/** Smallest normalized positive value */
/** Smallest normalized positive value. */
export const MIN_POSITIVE_VALUE: f64;
/** Smallest safely representable integer value. */
export const MIN_SAFE_INTEGER: f64;

26
std/portable.d.ts vendored
View File

@ -29,63 +29,83 @@ declare type f64 = number;
/** Converts any other numeric value to an 8-bit signed integer. */
declare function i8(value: i8 | i16 | i32 | isize | u8 | u16 | u32 | usize | bool | f32 | f64): i8;
declare namespace i8 {
/** Smallest representable value. */
export const MIN_VALUE: i8;
/** Largest representable value. */
export const MAX_VALUE: i8;
}
/** Converts any other numeric value to a 16-bit signed integer. */
declare function i16(value: i8 | i16 | i32 | isize | u8 | u16 | u32 | usize | bool | f32 | f64): i8;
declare namespace i16 {
/** Smallest representable value. */
export const MIN_VALUE: i16;
/** Largest representable value. */
export const MAX_VALUE: i16;
}
/** Converts any other numeric value to a 32-bit signed integer. */
declare function i32(value: i8 | i16 | i32 | isize | u8 | u16 | u32 | usize | bool | f32 | f64): i32;
declare namespace i32 {
/** Smallest representable value. */
export const MIN_VALUE: i32;
/** Largest representable value. */
export const MAX_VALUE: i32;
}
/** Converts any other numeric value to a 32-bit (in WASM32) respectivel 64-bit (in WASM64) signed integer. */
declare function isize(value: i8 | i16 | i32 | isize | u8 | u16 | u32 | usize | bool | f32 | f64): isize;
declare namespace isize {
/** Smallest representable value. */
export const MIN_VALUE: isize;
/** Largest representable value. */
export const MAX_VALUE: isize;
}
/** Converts any other numeric value to an 8-bit unsigned integer. */
declare function u8(value: i8 | i16 | i32 | isize | u8 | u16 | u32 | usize | bool | f32 | f64): i8;
declare namespace u8 {
/** Smallest representable value. */
export const MIN_VALUE: u8;
/** Largest representable value. */
export const MAX_VALUE: u8;
}
/** Converts any other numeric value to a 16-bit unsigned integer. */
declare function u16(value: i8 | i16 | i32 | isize | u8 | u16 | u32 | usize | bool | f32 | f64): i8;
declare namespace u16 {
/** Smallest representable value. */
export const MIN_VALUE: u16;
/** Largest representable value. */
export const MAX_VALUE: u16;
}
/** Converts any other numeric value to a 32-bit unsigned integer. */
declare function u32(value: i8 | i16 | i32 | isize | u8 | u16 | u32 | usize | bool | f32 | f64): i32;
declare namespace u32 {
/** Smallest representable value. */
export const MIN_VALUE: u32;
/** Largest representable value. */
export const MAX_VALUE: u32;
}
/** Converts any other numeric value to a 32-bit (in WASM32) respectivel 64-bit (in WASM64) unsigned integer. */
declare function usize(value: i8 | i16 | i32 | isize | u8 | u16 | u32 | usize | bool | f32 | f64): isize;
declare namespace usize {
/** Smallest representable value. */
export const MIN_VALUE: usize;
/** Largest representable value. */
export const MAX_VALUE: usize;
}
/** Converts any other numeric value to a 1-bit unsigned integer. */
declare function bool(value: i8 | i16 | i32 | isize | u8 | u16 | u32 | usize | bool | f32 | f64): bool;
declare namespace bool {
/** Smallest representable value. */
export const MIN_VALUE: bool;
/** Largest representable value. */
export const MAX_VALUE: bool;
}
/** Converts any other numeric value to a 32-bit float. */
declare function f32(value: i8 | i16 | i32 | isize | u8 | u16 | u32 | usize | bool | f32 | f64): f32;
declare namespace f32 {
/** Smallest representable value. */
export const MIN_VALUE: f32;
/** Largest representable value. */
export const MAX_VALUE: f32;
/** Smallest normalized positive value */
/** Smallest normalized positive value. */
export const MIN_POSITIVE_VALUE: f32;
/** Smallest safely representable integer value. */
export const MIN_SAFE_INTEGER: f32;
@ -97,9 +117,11 @@ declare namespace f32 {
/** Converts any other numeric value to a 64-bit float. */
declare function f64(value: i8 | i16 | i32 | isize | u8 | u16 | u32 | usize | bool | f32 | f64): f64;
declare namespace f64 {
/** Smallest representable value. */
export const MIN_VALUE: f64;
/** Largest representable value. */
export const MAX_VALUE: f64;
/** Smallest normalized positive value */
/** Smallest normalized positive value. */
export const MIN_POSITIVE_VALUE: f64;
/** Smallest safely representable integer value. */
export const MIN_SAFE_INTEGER: f64;