Adds partial additional debugging info
This commit is contained in:
parent
0aa8207987
commit
a85129254d
2
Makefile
2
Makefile
@ -1,4 +1,4 @@
|
|||||||
WABT_DIR := /home/johan/Sources/github.com/WebAssembly/wabt
|
WABT_DIR := /home/johan/sources/github.com/WebAssembly/wabt
|
||||||
|
|
||||||
WAT2WASM := $(WABT_DIR)/bin/wat2wasm
|
WAT2WASM := $(WABT_DIR)/bin/wat2wasm
|
||||||
WASM2C := $(WABT_DIR)/bin/wasm2c
|
WASM2C := $(WABT_DIR)/bin/wasm2c
|
||||||
|
|||||||
@ -16,11 +16,12 @@ class Error:
|
|||||||
This means the programmer has to make some kind of chance to the
|
This means the programmer has to make some kind of chance to the
|
||||||
typing of their program before the compiler can do its thing.
|
typing of their program before the compiler can do its thing.
|
||||||
"""
|
"""
|
||||||
def __init__(self, msg: str) -> None:
|
def __init__(self, msg: str, *, comment: Optional[str] = None) -> None:
|
||||||
self.msg = msg
|
self.msg = msg
|
||||||
|
self.comment = comment
|
||||||
|
|
||||||
def __repr__(self) -> str:
|
def __repr__(self) -> str:
|
||||||
return f'Error({repr(self.msg)})'
|
return f'Error({repr(self.msg)}, comment={repr(self.comment)})'
|
||||||
|
|
||||||
class RequireTypeSubstitutes:
|
class RequireTypeSubstitutes:
|
||||||
"""
|
"""
|
||||||
@ -135,10 +136,10 @@ class SameTypeConstraint(ConstraintBase):
|
|||||||
for typ in known_types[1:]:
|
for typ in known_types[1:]:
|
||||||
if isinstance(first_type, types.AppliedType3) and isinstance(typ, types.AppliedType3):
|
if isinstance(first_type, types.AppliedType3) and isinstance(typ, types.AppliedType3):
|
||||||
if len(first_type.args) != len(typ.args):
|
if len(first_type.args) != len(typ.args):
|
||||||
return Error('Mismatch between applied types argument count')
|
return Error('Mismatch between applied types argument count', comment=self.comment)
|
||||||
|
|
||||||
if first_type.base != typ.base:
|
if first_type.base != typ.base:
|
||||||
return Error('Mismatch between applied types base')
|
return Error('Mismatch between applied types base', comment=self.comment)
|
||||||
|
|
||||||
for first_type_arg, typ_arg in zip(first_type.args, typ.args):
|
for first_type_arg, typ_arg in zip(first_type.args, typ.args):
|
||||||
new_constraint_list.append(SameTypeConstraint(
|
new_constraint_list.append(SameTypeConstraint(
|
||||||
@ -148,7 +149,7 @@ class SameTypeConstraint(ConstraintBase):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
if typ != first_type:
|
if typ != first_type:
|
||||||
return Error(f'{typ:s} must be {first_type:s} instead')
|
return Error(f'{typ:s} must be {first_type:s} instead', comment=self.comment)
|
||||||
|
|
||||||
if new_constraint_list:
|
if new_constraint_list:
|
||||||
# If this happens, make CheckResult a class that can have both
|
# If this happens, make CheckResult a class that can have both
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user