意外的T_OBJECT_OPERATOR,但没有TypeChecker错误(Hacklang)

时间:2016-02-20 14:38:10

标签: hacklang

<?hh //strict 
foreach ($list as $id) {
    $items = new DestinationsByCountry($id);
    $remapped = $items->byKey('destination_id')->map($stringed ==> (int) $stringed);
    $this->ids->addAll($remapped);
}
foreach ($list as $id) {
    $this->ids->addAll(
        // ******* error line below *******
        new DestinationsByCountry($id)
            ->byKey('destination_id')
            ->map($stringed ==> (int) $stringed)
    );
}

对于类型检查者来说两者都可以,但第二个导致致命错误

  

致命错误:语法错误,意外T_OBJECT_OPERATOR,期待')'

1 个答案:

答案 0 :(得分:1)

正如上面的评论中所指出的,你需要在body.products table { table-layout: fixed; } body.products table tr:first-child > td { width:50%; } body.products input.add[type="button"] { color: white; width: 100%; background-color: #27af60; border: none; letter-spacing: .8px; } body.products input.del[type="button"] { color: white; width: 100%; background-color: #c0392b; border: none; letter-spacing: .8px; } body.products input.submit[type="submit"] { color: white; width: 100%; background-color: gray; border: none; letter-spacing: .8px; }周围使用括号,包括PHP和Hack语法。

typechecker没有抱怨的原因是因为it doesn't typecheck code at toplevel。如果这是在一个函数或方法中,我希望typechecker会发现错误。如果此代码实际上在函数或方法中,请执行file an issue on GitHub