Giter Club home page Giter Club logo

Comments (2)

jhnaldo avatar jhnaldo commented on July 30, 2024

SAFE is a framework to support implementing various JavaScript static analysis techniques and bug detectors. Thus, only basic techniques and detectors are implemented in SAFE. If you want to implement an arity checker, you can implement it by simply extending the bug detector. It currently provides 1) absent property read:

private def checkExpr(expr: CFGExpr, state: AbsState,

and 2) always false or true branches
private def checkBlock(block: CFGBlock, semantics: Semantics): List[String] =

as example detectors.

By the way, JavaScript allows function invocations with different arities, and some developers want to use this language feature to mimic function overloading. Therefore, I think that detecting arity mismatches as bugs might be annoying to some developers.

from safe.

dckc avatar dckc commented on July 30, 2024

SAFE ... currently provides 1) absent property read ... and 2) always false or true branches
as example detectors.

OK, yes, this works as expected, then:

function shoeSize(shoe) {
  if (shoe || ~shoe) {
    console.log('to be or not to be');
  }
  return shoe.size;
}

shoeSize({ large: true });
$ safe bugDetect buggy.js 
buggy.js:
1 error:
    kr.ac.kaist.safe.errors.error.IdNotBoundError: buggy.js:3:5-12: Identifier console is not bound.
No warning
buggy.js:3:5-38:
    [Warning] The property "log" of the object "console["log"]('to be or not to be')" is absent.
buggy.js:2:7-11:
    [Warning] The conditional expression "shoe" is always true.
The command 'bugDetect' took 1608 ms.

... I think that detecting arity mismatches as bugs might be annoying to some developers.

I was confusing SAFE with JSTAR:

JSTAR performs a type analysis and detects specification bugs using a bug detector consisting of four checkers: 1) a reference checker, 2) an arity checker, 3) an assertion checker, and 4) an operand checker. -- https://github.com/kaist-plrg/jstar/blob/main/ase21-park-jstar.pdf

from safe.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.