Merge branch 'main' into dict

This commit is contained in:
Shunsuke Shibayama 2022-10-12 13:20:05 +09:00
commit e647c9545f
13 changed files with 111 additions and 19 deletions

View file

@ -33,6 +33,7 @@ pub enum Opcode {
BINARY_ADD = 23, BINARY_ADD = 23,
BINARY_SUBTRACT = 24, BINARY_SUBTRACT = 24,
BINARY_SUBSCR = 25, BINARY_SUBSCR = 25,
BINARY_FLOOR_DIVIDE = 26,
BINARY_TRUE_DIVIDE = 27, BINARY_TRUE_DIVIDE = 27,
INPLACE_FLOOR_DIVIDE = 28, INPLACE_FLOOR_DIVIDE = 28,
INPLACE_TRUE_DIVIDE = 29, INPLACE_TRUE_DIVIDE = 29,
@ -183,6 +184,7 @@ impl From<u8> for Opcode {
23 => BINARY_ADD, 23 => BINARY_ADD,
24 => BINARY_SUBTRACT, 24 => BINARY_SUBTRACT,
25 => BINARY_SUBSCR, 25 => BINARY_SUBSCR,
26 => BINARY_FLOOR_DIVIDE,
27 => BINARY_TRUE_DIVIDE, 27 => BINARY_TRUE_DIVIDE,
28 => INPLACE_FLOOR_DIVIDE, 28 => INPLACE_FLOOR_DIVIDE,
29 => INPLACE_TRUE_DIVIDE, 29 => INPLACE_TRUE_DIVIDE,

View file

@ -1163,6 +1163,7 @@ impl CodeGenerator {
TokenKind::Minus => BINARY_SUBTRACT, TokenKind::Minus => BINARY_SUBTRACT,
TokenKind::Star => BINARY_MULTIPLY, TokenKind::Star => BINARY_MULTIPLY,
TokenKind::Slash => BINARY_TRUE_DIVIDE, TokenKind::Slash => BINARY_TRUE_DIVIDE,
TokenKind::FloorDiv => BINARY_FLOOR_DIVIDE,
TokenKind::Pow => BINARY_POWER, TokenKind::Pow => BINARY_POWER,
TokenKind::Mod => BINARY_MODULO, TokenKind::Mod => BINARY_MODULO,
TokenKind::AndOp => BINARY_AND, TokenKind::AndOp => BINARY_AND,

View file

@ -54,6 +54,7 @@ fn try_get_op_kind_from_token(kind: TokenKind) -> EvalResult<OpKind> {
TokenKind::Minus => Ok(OpKind::Sub), TokenKind::Minus => Ok(OpKind::Sub),
TokenKind::Star => Ok(OpKind::Mul), TokenKind::Star => Ok(OpKind::Mul),
TokenKind::Slash => Ok(OpKind::Div), TokenKind::Slash => Ok(OpKind::Div),
TokenKind::FloorDiv => Ok(OpKind::FloorDiv),
TokenKind::Pow => Ok(OpKind::Pow), TokenKind::Pow => Ok(OpKind::Pow),
TokenKind::Mod => Ok(OpKind::Mod), TokenKind::Mod => Ok(OpKind::Mod),
TokenKind::DblEq => Ok(OpKind::Eq), TokenKind::DblEq => Ok(OpKind::Eq),
@ -80,6 +81,7 @@ fn op_to_name(op: OpKind) -> &'static str {
OpKind::Sub => "__sub__", OpKind::Sub => "__sub__",
OpKind::Mul => "__mul__", OpKind::Mul => "__mul__",
OpKind::Div => "__div__", OpKind::Div => "__div__",
OpKind::FloorDiv => "__floordiv__",
OpKind::Mod => "__mod__", OpKind::Mod => "__mod__",
OpKind::Pow => "__pow__", OpKind::Pow => "__pow__",
OpKind::Pos => "__pos__", OpKind::Pos => "__pos__",
@ -645,6 +647,13 @@ impl Context {
line!(), line!(),
)) ))
}), }),
FloorDiv => lhs.try_floordiv(rhs).ok_or_else(|| {
EvalErrors::from(EvalError::unreachable(
self.cfg.input.clone(),
fn_name!(),
line!(),
))
}),
Gt => lhs.try_gt(rhs).ok_or_else(|| { Gt => lhs.try_gt(rhs).ok_or_else(|| {
EvalErrors::from(EvalError::unreachable( EvalErrors::from(EvalError::unreachable(
self.cfg.input.clone(), self.cfg.input.clone(),

View file

@ -370,13 +370,21 @@ impl Context {
mul.register_builtin_decl("__mul__", op_t, Public); mul.register_builtin_decl("__mul__", op_t, Public);
mul.register_builtin_decl("Output", Type, Public); mul.register_builtin_decl("Output", Type, Public);
/* Div */ /* Div */
let mut div = Self::builtin_poly_trait("Div", params, 2); let mut div = Self::builtin_poly_trait("Div", params.clone(), 2);
div.register_superclass(poly("Output", vec![ty_tp(mono_q("R"))]), &output); div.register_superclass(poly("Output", vec![ty_tp(mono_q("R"))]), &output);
let op_t = fn1_met(mono_q("Self"), r, proj(mono_q("Self"), "Output")); let op_t = fn1_met(mono_q("Self"), r.clone(), proj(mono_q("Self"), "Output"));
let self_bound = subtypeof(mono_q("Self"), poly("Div", ty_params.clone())); let self_bound = subtypeof(mono_q("Self"), poly("Div", ty_params.clone()));
let op_t = quant(op_t, set! {r_bound, self_bound}); let op_t = quant(op_t, set! {r_bound.clone(), self_bound});
div.register_builtin_decl("__div__", op_t, Public); div.register_builtin_decl("__div__", op_t, Public);
div.register_builtin_decl("Output", Type, Public); div.register_builtin_decl("Output", Type, Public);
/* FloorDiv */
let mut floor_div = Self::builtin_poly_trait("FloorDiv", params, 2);
floor_div.register_superclass(poly("Output", vec![ty_tp(mono_q("R"))]), &output);
let op_t = fn1_met(mono_q("Self"), r, proj(mono_q("Self"), "Output"));
let self_bound = subtypeof(mono_q("Self"), poly("FloorDiv", ty_params.clone()));
let op_t = quant(op_t, set! {r_bound, self_bound});
floor_div.register_builtin_decl("__floordiv__", op_t, Public);
floor_div.register_builtin_decl("Output", Type, Public);
self.register_builtin_type(mono("Unpack"), unpack, Private, Const); self.register_builtin_type(mono("Unpack"), unpack, Private, Const);
self.register_builtin_type(mono("InheritableType"), inheritable_type, Private, Const); self.register_builtin_type(mono("InheritableType"), inheritable_type, Private, Const);
self.register_builtin_type(mono("Named"), named, Private, Const); self.register_builtin_type(mono("Named"), named, Private, Const);
@ -412,7 +420,8 @@ impl Context {
self.register_builtin_type(poly("Add", ty_params.clone()), add, Private, Const); self.register_builtin_type(poly("Add", ty_params.clone()), add, Private, Const);
self.register_builtin_type(poly("Sub", ty_params.clone()), sub, Private, Const); self.register_builtin_type(poly("Sub", ty_params.clone()), sub, Private, Const);
self.register_builtin_type(poly("Mul", ty_params.clone()), mul, Private, Const); self.register_builtin_type(poly("Mul", ty_params.clone()), mul, Private, Const);
self.register_builtin_type(poly("Div", ty_params), div, Private, Const); self.register_builtin_type(poly("Div", ty_params.clone()), div, Private, Const);
self.register_builtin_type(poly("FloorDiv", ty_params), floor_div, Private, Const);
self.register_const_param_defaults( self.register_const_param_defaults(
"Eq", "Eq",
vec![ConstTemplate::Obj(ValueObj::builtin_t(mono_q("Self")))], vec![ConstTemplate::Obj(ValueObj::builtin_t(mono_q("Self")))],
@ -437,6 +446,10 @@ impl Context {
"Div", "Div",
vec![ConstTemplate::Obj(ValueObj::builtin_t(mono_q("Self")))], vec![ConstTemplate::Obj(ValueObj::builtin_t(mono_q("Self")))],
); );
self.register_const_param_defaults(
"FloorDiv",
vec![ConstTemplate::Obj(ValueObj::builtin_t(mono_q("Self")))],
);
} }
fn init_builtin_classes(&mut self) { fn init_builtin_classes(&mut self) {
@ -501,10 +514,14 @@ impl Context {
float_mul.register_builtin_const("PowOutput", Public, ValueObj::builtin_t(Float)); float_mul.register_builtin_const("PowOutput", Public, ValueObj::builtin_t(Float));
float.register_trait(Float, poly("Mul", vec![ty_tp(Float)]), float_mul); float.register_trait(Float, poly("Mul", vec![ty_tp(Float)]), float_mul);
let mut float_div = Self::builtin_methods("Div", 2); let mut float_div = Self::builtin_methods("Div", 2);
float_div.register_builtin_impl("__div__", op_t, Const, Public); float_div.register_builtin_impl("__div__", op_t.clone(), Const, Public);
float_div.register_builtin_const("Output", Public, ValueObj::builtin_t(Float)); float_div.register_builtin_const("Output", Public, ValueObj::builtin_t(Float));
float_div.register_builtin_const("ModOutput", Public, ValueObj::builtin_t(Float)); float_div.register_builtin_const("ModOutput", Public, ValueObj::builtin_t(Float));
float.register_trait(Float, poly("Div", vec![ty_tp(Float)]), float_div); float.register_trait(Float, poly("Div", vec![ty_tp(Float)]), float_div);
let mut float_floordiv = Self::builtin_methods("FloorDiv", 2);
float_floordiv.register_builtin_impl("__floordiv__", op_t, Const, Public);
float_floordiv.register_builtin_const("Output", Public, ValueObj::builtin_t(Float));
float.register_trait(Float, poly("FloorDiv", vec![ty_tp(Float)]), float_floordiv);
let mut float_mutizable = Self::builtin_methods("Mutizable", 2); let mut float_mutizable = Self::builtin_methods("Mutizable", 2);
float_mutizable.register_builtin_const( float_mutizable.register_builtin_const(
"MutType!", "MutType!",
@ -555,10 +572,14 @@ impl Context {
ratio_mul.register_builtin_const("PowOutput", Public, ValueObj::builtin_t(Ratio)); ratio_mul.register_builtin_const("PowOutput", Public, ValueObj::builtin_t(Ratio));
ratio.register_trait(Ratio, poly("Mul", vec![ty_tp(Ratio)]), ratio_mul); ratio.register_trait(Ratio, poly("Mul", vec![ty_tp(Ratio)]), ratio_mul);
let mut ratio_div = Self::builtin_methods("Div", 2); let mut ratio_div = Self::builtin_methods("Div", 2);
ratio_div.register_builtin_impl("__div__", op_t, Const, Public); ratio_div.register_builtin_impl("__div__", op_t.clone(), Const, Public);
ratio_div.register_builtin_const("Output", Public, ValueObj::builtin_t(Ratio)); ratio_div.register_builtin_const("Output", Public, ValueObj::builtin_t(Ratio));
ratio_div.register_builtin_const("ModOutput", Public, ValueObj::builtin_t(Ratio)); ratio_div.register_builtin_const("ModOutput", Public, ValueObj::builtin_t(Ratio));
ratio.register_trait(Ratio, poly("Div", vec![ty_tp(Ratio)]), ratio_div); ratio.register_trait(Ratio, poly("Div", vec![ty_tp(Ratio)]), ratio_div);
let mut ratio_floordiv = Self::builtin_methods("FloorDiv", 2);
ratio_floordiv.register_builtin_impl("__floordiv__", op_t, Const, Public);
ratio_floordiv.register_builtin_const("Output", Public, ValueObj::builtin_t(Ratio));
ratio.register_trait(Ratio, poly("FloorDiv", vec![ty_tp(Ratio)]), ratio_floordiv);
let mut ratio_mutizable = Self::builtin_methods("Mutizable", 2); let mut ratio_mutizable = Self::builtin_methods("Mutizable", 2);
ratio_mutizable.register_builtin_const( ratio_mutizable.register_builtin_const(
"MutType!", "MutType!",
@ -602,10 +623,14 @@ impl Context {
int_sub.register_builtin_const("Output", Public, ValueObj::builtin_t(Int)); int_sub.register_builtin_const("Output", Public, ValueObj::builtin_t(Int));
int.register_trait(Int, poly("Sub", vec![ty_tp(Int)]), int_sub); int.register_trait(Int, poly("Sub", vec![ty_tp(Int)]), int_sub);
let mut int_mul = Self::builtin_methods("Mul", 2); let mut int_mul = Self::builtin_methods("Mul", 2);
int_mul.register_builtin_impl("__mul__", op_t, Const, Public); int_mul.register_builtin_impl("__mul__", op_t.clone(), Const, Public);
int_mul.register_builtin_const("Output", Public, ValueObj::builtin_t(Int)); int_mul.register_builtin_const("Output", Public, ValueObj::builtin_t(Int));
int_mul.register_builtin_const("PowOutput", Public, ValueObj::builtin_t(Nat)); int_mul.register_builtin_const("PowOutput", Public, ValueObj::builtin_t(Nat));
int.register_trait(Int, poly("Mul", vec![ty_tp(Int)]), int_mul); int.register_trait(Int, poly("Mul", vec![ty_tp(Int)]), int_mul);
let mut int_floordiv = Self::builtin_methods("FloorDiv", 2);
int_floordiv.register_builtin_impl("__floordiv__", op_t, Const, Public);
int_floordiv.register_builtin_const("Output", Public, ValueObj::builtin_t(Int));
int.register_trait(Int, poly("FloorDiv", vec![ty_tp(Int)]), int_floordiv);
let mut int_mutizable = Self::builtin_methods("Mutizable", 2); let mut int_mutizable = Self::builtin_methods("Mutizable", 2);
int_mutizable.register_builtin_const("MutType!", Public, ValueObj::builtin_t(mono("Int!"))); int_mutizable.register_builtin_const("MutType!", Public, ValueObj::builtin_t(mono("Int!")));
int.register_trait(Int, mono("Mutizable"), int_mutizable); int.register_trait(Int, mono("Mutizable"), int_mutizable);
@ -653,9 +678,13 @@ impl Context {
nat_add.register_builtin_const("Output", Public, ValueObj::builtin_t(Nat)); nat_add.register_builtin_const("Output", Public, ValueObj::builtin_t(Nat));
nat.register_trait(Nat, poly("Add", vec![ty_tp(Nat)]), nat_add); nat.register_trait(Nat, poly("Add", vec![ty_tp(Nat)]), nat_add);
let mut nat_mul = Self::builtin_methods("Mul", 2); let mut nat_mul = Self::builtin_methods("Mul", 2);
nat_mul.register_builtin_impl("__mul__", op_t, Const, Public); nat_mul.register_builtin_impl("__mul__", op_t.clone(), Const, Public);
nat_mul.register_builtin_const("Output", Public, ValueObj::builtin_t(Nat)); nat_mul.register_builtin_const("Output", Public, ValueObj::builtin_t(Nat));
nat.register_trait(Nat, poly("Mul", vec![ty_tp(Nat)]), nat_mul); nat.register_trait(Nat, poly("Mul", vec![ty_tp(Nat)]), nat_mul);
let mut nat_floordiv = Self::builtin_methods("FloorDiv", 2);
nat_floordiv.register_builtin_impl("__floordiv__", op_t, Const, Public);
nat_floordiv.register_builtin_const("Output", Public, ValueObj::builtin_t(Nat));
nat.register_trait(Nat, poly("FloorDiv", vec![ty_tp(Nat)]), nat_floordiv);
let mut nat_mutizable = Self::builtin_methods("Mutizable", 2); let mut nat_mutizable = Self::builtin_methods("Mutizable", 2);
nat_mutizable.register_builtin_const("MutType!", Public, ValueObj::builtin_t(mono("Nat!"))); nat_mutizable.register_builtin_const("MutType!", Public, ValueObj::builtin_t(mono("Nat!")));
nat.register_trait(Nat, mono("Mutizable"), nat_mutizable); nat.register_trait(Nat, mono("Mutizable"), nat_mutizable);
@ -687,10 +716,6 @@ impl Context {
let mut bool_eq = Self::builtin_methods("Eq", 2); let mut bool_eq = Self::builtin_methods("Eq", 2);
bool_eq.register_builtin_impl("__eq__", fn1_met(Bool, Bool, Bool), Const, Public); bool_eq.register_builtin_impl("__eq__", fn1_met(Bool, Bool, Bool), Const, Public);
bool_.register_trait(Bool, poly("Eq", vec![ty_tp(Bool)]), bool_eq); bool_.register_trait(Bool, poly("Eq", vec![ty_tp(Bool)]), bool_eq);
let mut bool_add = Self::builtin_methods("Add", 2);
bool_add.register_builtin_impl("__add__", fn1_met(Bool, Bool, Int), Const, Public);
bool_add.register_builtin_const("Output", Public, ValueObj::builtin_t(Nat));
bool_.register_trait(Bool, poly("Add", vec![ty_tp(Bool)]), bool_add);
let mut bool_mutizable = Self::builtin_methods("Mutizable", 2); let mut bool_mutizable = Self::builtin_methods("Mutizable", 2);
bool_mutizable.register_builtin_const( bool_mutizable.register_builtin_const(
"MutType!", "MutType!",
@ -1634,6 +1659,15 @@ impl Context {
}, },
); );
self.register_builtin_impl("__div__", op_t, Const, Private); self.register_builtin_impl("__div__", op_t, Const, Private);
let op_t = bin_op(l.clone(), r.clone(), proj(mono_q("L"), "Output"));
let op_t = quant(
op_t,
set! {
static_instance("R", Type),
subtypeof(l.clone(), poly("FloorDiv", params.clone()))
},
);
self.register_builtin_impl("__floordiv__", op_t, Const, Private);
let m = mono_q("M"); let m = mono_q("M");
let op_t = bin_op(m.clone(), m.clone(), proj(m.clone(), "PowOutput")); let op_t = bin_op(m.clone(), m.clone(), proj(m.clone(), "PowOutput"));
let op_t = quant(op_t, set! {subtypeof(m, poly("Mul", vec![]))}); let op_t = quant(op_t, set! {subtypeof(m, poly("Mul", vec![]))});

View file

@ -1379,7 +1379,10 @@ impl Context {
.super_classes .super_classes
.iter() .iter()
.chain(ctx.super_traits.iter()) .chain(ctx.super_traits.iter())
.map(|sup| self.get_nominal_type_ctx(sup).unwrap()); .map(|sup| {
self.get_nominal_type_ctx(sup)
.expect("compiler bug: sup not found")
});
Some(vec![ctx].into_iter().chain(sups)) Some(vec![ctx].into_iter().chain(sups))
} }

View file

@ -25,6 +25,7 @@ pub fn binop_to_dname(op: &str) -> &str {
"-" => "__sub__", "-" => "__sub__",
"*" => "__mul__", "*" => "__mul__",
"/" => "__div__", "/" => "__div__",
"//" => "__floordiv__",
"**" => "__pow__", "**" => "__pow__",
"%" => "__mod__", "%" => "__mod__",
".." => "__rng__", ".." => "__rng__",
@ -66,6 +67,7 @@ pub fn readable_name(name: &str) -> &str {
"__sub__" => "`-`", "__sub__" => "`-`",
"__mul__" => "`*`", "__mul__" => "`*`",
"__div__" => "`/`", "__div__" => "`/`",
"__floordiv__" => "`//`",
"__pow__" => "`**`", "__pow__" => "`**`",
"__mod__" => "`%`", "__mod__" => "`%`",
"__rng__" => "`..`", "__rng__" => "`..`",

View file

@ -20,6 +20,7 @@ pub enum OpKind {
Sub, Sub,
Mul, Mul,
Div, Div,
FloorDiv,
Pow, Pow,
Mod, Mod,
Pos, Pos,
@ -48,6 +49,7 @@ impl fmt::Display for OpKind {
Self::Sub => write!(f, "-"), Self::Sub => write!(f, "-"),
Self::Mul => write!(f, "*"), Self::Mul => write!(f, "*"),
Self::Div => write!(f, "/"), Self::Div => write!(f, "/"),
Self::FloorDiv => write!(f, "//"),
Self::Pow => write!(f, "**"), Self::Pow => write!(f, "**"),
Self::Mod => write!(f, "%"), Self::Mod => write!(f, "%"),
Self::Pos => write!(f, "+"), Self::Pos => write!(f, "+"),

View file

@ -687,6 +687,30 @@ impl ValueObj {
} }
} }
pub fn try_floordiv(self, other: Self) -> Option<Self> {
match (self, other) {
(Self::Int(l), Self::Int(r)) => Some(Self::Int(l / r)),
(Self::Nat(l), Self::Nat(r)) => Some(Self::Nat(l / r)),
(Self::Float(l), Self::Float(r)) => Some(Self::Float((l / r).floor())),
(Self::Int(l), Self::Nat(r)) => Some(Self::Int(l / r as i32)),
(Self::Nat(l), Self::Int(r)) => Some(Self::Int(l as i32 / r)),
(Self::Float(l), Self::Nat(r)) => Some(Self::Float((l / r as f64).floor())),
(Self::Nat(l), Self::Float(r)) => Some(Self::Float((l as f64 / r).floor())),
(Self::Float(l), Self::Int(r)) => Some(Self::Float((l / r as f64).floor())),
(Self::Int(l), Self::Float(r)) => Some(Self::Float((l as f64 / r).floor())),
(Self::Mut(m), other) => {
{
let ref_m = &mut *m.borrow_mut();
*ref_m = mem::take(ref_m).try_div(other)?;
}
Some(Self::Mut(m))
}
(self_, Self::Mut(m)) => self_.try_floordiv(m.borrow().clone()),
// TODO: x//±Inf = 0
_ => None,
}
}
pub fn try_gt(self, other: Self) -> Option<Self> { pub fn try_gt(self, other: Self) -> Option<Self> {
match (self, other) { match (self, other) {
(Self::Int(l), Self::Int(r)) => Some(Self::from(l > r)), (Self::Int(l), Self::Int(r)) => Some(Self::from(l > r)),

View file

@ -478,8 +478,8 @@ impl Lexer /*<'a>*/ {
token.loc(), token.loc(),
switch_lang!( switch_lang!(
"japanese" => format!("`{}`は無効な十進数リテラルです", &token.content), "japanese" => format!("`{}`は無効な十進数リテラルです", &token.content),
"simplified_chinese" => format!("`{}`是无效的十进制字", &token.content), "simplified_chinese" => format!("`{}`是无效的十进制字面量", &token.content),
"traditional_chinese" => format!("`{}`是無效的十進製文字", &token.content), "traditional_chinese" => format!("`{}`是無效的十進位字面量", &token.content),
"english" => format!("`{}` is invalid decimal literal", &token.content), "english" => format!("`{}` is invalid decimal literal", &token.content),
), ),
None, None,

View file

@ -7,3 +7,7 @@ A: The branch you are working on may not be following the changes in `main`.
## Q: The pre-commit check fails ## Q: The pre-commit check fails
A: Try committing again. It may fail the first time. If it fails again and again, the code may contain a bug. A: Try committing again. It may fail the first time. If it fails again and again, the code may contain a bug.
## Q: build.rs fails to run
A: Check for extra files/directories (such as `__pychache__`) on the directory where `build.rs` runs.

View file

@ -1,7 +1,6 @@
# トラブルシューティング # トラブルシューティング
[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/dev_guide/troubleshooting.md%26commit_hash%3De033e4942e70657008427f05def2d1b1bfb5ed66)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/dev_guide/troubleshooting.md&commit_hash=e033e4942e70657008427f05def2d1b1bfb5ed66) [![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/dev_guide/troubleshooting.md%26commit_hash%3Db57b46405734013fee2925f43d4a46ad8898267d)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/dev_guide/troubleshooting.md&commit_hash=b57b46405734013fee2925f43d4a46ad8898267d)
## Q: ローカルでのビルドは成功したが、GitHub Actionsのビルドが失敗する ## Q: ローカルでのビルドは成功したが、GitHub Actionsのビルドが失敗する
@ -10,3 +9,7 @@ A: あなたの作業しているブランチが`main`の変更に追従して
## Q: pre-commitのチェックが失敗する ## Q: pre-commitのチェックが失敗する
A: もう一度コミットを試みてください。最初の1回は失敗することがあります。何度やっても失敗する場合、コードにバグが含まれている可能性があります。 A: もう一度コミットを試みてください。最初の1回は失敗することがあります。何度やっても失敗する場合、コードにバグが含まれている可能性があります。
## Q: build.rsの実行に失敗する
A: build.rsが動作するディレクトリ上に余計なファイル・ディレクトリ(`__pychache__`など)がないか確認してください。

View file

@ -1,6 +1,6 @@
# 故障诊断 # 故障诊断
[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/dev_guide/troubleshooting.md%26commit_hash%3De033e4942e70657008427f05def2d1b1bfb5ed66)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/dev_guide/troubleshooting.md&commit_hash=e033e4942e70657008427f05def2d1b1bfb5ed66) [![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/dev_guide/troubleshooting.md%26commit_hash%3Db57b46405734013fee2925f43d4a46ad8898267d)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/dev_guide/troubleshooting.md&commit_hash=b57b46405734013fee2925f43d4a46ad8898267d)
## Q: 本地生成成功, 但 GitHub Actions 生成失败 ## Q: 本地生成成功, 但 GitHub Actions 生成失败
@ -9,3 +9,7 @@ A: 您正在处理的分支可能没有Pull`main`中的更改
## Q: 提交前检查失败 ## Q: 提交前检查失败
A: 尝试再次提交, 第一次可能会误判, 如果一次又一次的失败, 那么你的代码可能包含错误 A: 尝试再次提交, 第一次可能会误判, 如果一次又一次的失败, 那么你的代码可能包含错误
## Q: build.rs 无法正常运行
A: 检查 `build.rs` 运行目录中的额外文件/文件夹 (例如 `__pychache__`)

View file

@ -1,6 +1,6 @@
# 故障診斷 # 故障診斷
[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/dev_guide/troubleshooting.md%26commit_hash%3De033e4942e70657008427f05def2d1b1bfb5ed66)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/dev_guide/troubleshooting.md&commit_hash=e033e4942e70657008427f05def2d1b1bfb5ed66) [![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/dev_guide/troubleshooting.md%26commit_hash%3Db57b46405734013fee2925f43d4a46ad8898267d)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/dev_guide/troubleshooting.md&commit_hash=b57b46405734013fee2925f43d4a46ad8898267d)
## Q: 本地生成成功, 但 GitHub Actions 生成失敗 ## Q: 本地生成成功, 但 GitHub Actions 生成失敗
@ -9,3 +9,7 @@ A: 您正在處理的分支可能沒有Pull`main`中的更改
## Q: 提交前檢查失敗 ## Q: 提交前檢查失敗
A: 嘗試再次提交, 第一次可能會誤判, 如果一次又一次的失敗, 那麼你的代碼可能包含錯誤 A: 嘗試再次提交, 第一次可能會誤判, 如果一次又一次的失敗, 那麼你的代碼可能包含錯誤
## Q: build.rs 無法正常運行
A: 檢查`build. rs`運行目錄中的額外檔案/資料夾(例如`__pychache__`