Skip to content

Latest commit

 

History

History
77 lines (53 loc) · 660 Bytes

EdgeCase.md

File metadata and controls

77 lines (53 loc) · 660 Bytes

Edge Case

規範

Lit

lit!();

常數類型,不與fn輸入值有關 包含 call(lit!())

Expr

expr!(...)

...expr牽扯的變數

測試

test1

fn test_1(a: T) -> T {
    let a = lit!();
    take(a);
    a + lit!()
}

fn take(_: T) {}

test2

fn test_2(a: T) -> T {
    a.map(|x| expr!(x))
}

test3

fn test_3(a: T, b: T) -> T {
    if a < b {
        a
    } else {
        b
    }
}

test4

fn test_4(a: T,b: T) -> T {
    a.call(b)
}

test5

fn test_5(a: T, b: T) -> T {
    let c = a + b;
    let d = c * a;
    d
}