Comments (3)
#104 addresses these unit test, but some have been commented out because they currently fail on master.
Those tests highlight a few missing features in the checker and parser.
Checker currently doesn't identify incorrect types used as, or inside of, option blocks. That is with wrongOptionType
and with option { wrongOptionType; }
both pass, but shouldn't. It seems this also affects usage like myfunc option::run { someCopyOpt; }
where the option block is passed as a value.
In discussion with @hinshun we realized the need for CallSmt
s to be parsed as expressions, possibly as CallExpr
. The parser and checker should also accept BlockStmt
s that contain BasicLit
s, so that string myDir { "/var/lib/foo"; }
is a valid statement that assigns "/var/lib/foo"
as the return value of myDir
.
from hlb.
// Option blocks may be empty and may refer to identifiers or function
// literals that don't have a sub-type, so we check them differently.
if strings.HasPrefix(string(typ), string(parser.Option)) {
return c.checkOptionBlockStmt(scope, typ, block)
}
in checker.checkBlockStmt
seems to be the culprit for the checker issue.
@hinshun could you provide an example hlb program that has an option with a func literal that has no subtype? I'm not sure I know what that looks like and I want to write a test case for it so that I can try to fix the checker. NB if I comment out that block, most of the checks seem to work consistently.
from hlb.
@hinshun could you provide an example hlb program that has an option with a func literal that has no subtype? I'm not sure I know what that looks like and I want to write a test case for it so that I can try to fix the checker. NB if I comment out that block, most of the checks seem to work consistently.
I think what I meant by that comment is the following.
Option blocks may be empty.
fs default() {
image "alpine"
run "echo foo" with option {}
}
may refer to identifiers
fs default() {
image "alpine"
run "echo foo" with foo
}
option::run foo() {
env "key" "value"
}
or function literals that don't have sub-type
fs default() {
image "alpine"
run "echo foo" with option { # <<- no sub-type.
env "key" "value"
}
}
When I wrote sub-type
I was referring to (*parser.Type).Secondary()
. The identifier after the primary type (in this case, option
) followed by ::<sub-type>
. We should probably reword this comment. Let me know if that clarifies things!
from hlb.
Related Issues (20)
- BuildKit should support errors.Cause over GRPC
- speed up docker image loading into local daemon
- Add Type Reference Documentation HOT 1
- Build Method Should Be Updated in the Installation Docs
- What is the replacement for deprecated import syntax? HOT 5
- Should aliases be part of the function signature? HOT 3
- Incorrect Syntax Highlighting for Snake Case Function Name in vscode HOT 3
- Consider 2 pass codegen for precomputations
- Add tests for history commits
- add infinite loop detection
- Yet another proposal to fix binding signatures HOT 15
- "forward" option does not support multiple connections over TCP HOT 2
- Running nonexistent command with readonly root FS does not fail HOT 3
- building/pushing multi-platform images HOT 1
- platform confused when using multiple archs in same build graph HOT 2
- Array proposal HOT 5
- Arg(...).WithError prints erroneous diagonistic
- Source defined breakpoints within option::run are ignored
- ModuleDir function returns incorrect result HOT 10
- `--cache-from` alternative? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hlb.