Skip to content

Commit

Permalink
Merge branch 'master' into bastian/318-allow-path-export-
Browse files Browse the repository at this point in the history
  • Loading branch information
turbolent authored Sep 10, 2020
2 parents a1e6124 + 1cd2480 commit 05c67be
Show file tree
Hide file tree
Showing 25 changed files with 1,317 additions and 400 deletions.
44 changes: 40 additions & 4 deletions compat/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ This ensures that there is little noise and variance in the results.
- Disable using:

```sh
/bin/echo 1 > /sys/devices/system/cpu/intel_pstate/no_turbo
echo 1|sudo tee /sys/devices/system/cpu/intel_pstate/no_turbo
```

(If it has no effect, disable via BIOS)
Expand Down Expand Up @@ -75,9 +75,20 @@ This ensures that there is little noise and variance in the results.

should show `off`, `forceoff` (if disabled in BIOS), or `notsupported`

## Stop Systemd services
## Stop and disable systemd services

- `systemctl stop`

```
systemctl disable exim4
systemctl disable unattended-upgrades.service
systemctl disable packagekit.service
systemctl disable polkit.service
systemctl stop exim4
systemctl stop unattended-upgrades.service
systemctl stop packagekit.service
systemctl stop polkit.service
```

## Disable Address Space Randomization

Expand Down Expand Up @@ -118,6 +129,31 @@ This ensures that there is little noise and variance in the results.

- Run commands with: `cset shield --exec <command> -- <args>`

## Debian

### Install dependencies


- Install Go 1.14

1. Enable Buster backports

```
echo "deb http://deb.debian.org/debian buster-backports main" >> /etc/apt/sources.list
```
2. `apt-get update`
3. `apt-get -t buster-backports install golang`
- Install tools for configuring and running the suite
```
apt install linux-cpupower cpuset git python3-pip msr-tools
```
## Verifying
Run the benchmarks with `--compare-ref HEAD` to compare against the same code.
Expand All @@ -132,4 +168,4 @@ Result deltas should be <2-3%.
- https://pyperf.readthedocs.io/en/latest/system.html
- https://vstinner.github.io/journey-to-stable-benchmark-system.html
- https://developer.download.nvidia.com/video/gputechconf/gtc/2019/presentation/s9956-best-practices-when-benchmarking-cuda-applications_V2.pdf
- https://documentation.suse.com/sle-rt/12-SP4/html/SLE-RT-all/cha-shielding-model.html
- https://documentation.suse.com/sle-rt/12-SP4/html/SLE-RT-all/cha-shielding-model.html
13 changes: 13 additions & 0 deletions docs/development.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Development

## Running the latest version of the Language Server in the Visual Studio Code Extension

- Find the Visual Studio Code preference named "Cadence: Flow Command" and change it to:

```text
/path/to/cadence/languageserver/run.sh
```

- Restart Visual Studio Code

This will automatically recompile the language server every time it is started.
554 changes: 277 additions & 277 deletions docs/package-lock.json

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,28 @@
"private": true,
"dependencies": {
"get-stdin": "^7.0.0",
"puppeteer": "^1.19.0",
"puppeteer": "^1.20.0",
"rehype-add-classes": "^1.0.0",
"rehype-document": "^3.0.1",
"rehype-document": "^3.2.1",
"rehype-format": "^2.3.2",
"rehype-stringify": "^6.0.0",
"remark-autolink-headings": "^5.2.1",
"remark-parse": "^7.0.0",
"remark-preset-lint-markdown-style-guide": "^2.1.3",
"rehype-stringify": "^6.0.1",
"remark-autolink-headings": "^5.2.2",
"remark-parse": "^7.0.2",
"remark-preset-lint-markdown-style-guide": "^2.1.4",
"remark-rehype": "^5.0.0",
"remark-retext": "^3.1.3",
"remark-sectionize": "^1.0.1",
"remark-sectionize": "^1.1.1",
"remark-slug": "^5.1.2",
"remark-stringify": "^7.0.4",
"remark-toc": "^6.0.0",
"remark-validate-links": "^9.0.1",
"retext-english": "^3.0.3",
"remark-validate-links": "^9.2.0",
"retext-english": "^3.0.4",
"retext-indefinite-article": "^1.1.7",
"retext-repeated-words": "^2.0.0",
"to-vfile": "^6.0.0",
"unified": "^8.3.2",
"to-vfile": "^6.1.0",
"unified": "^8.4.2",
"unist-util-visit": "^1.4.1",
"vfile-reporter": "^6.0.0",
"vscode-textmate": "^4.2.2"
"vfile-reporter": "^6.0.1",
"vscode-textmate": "^4.4.0"
}
}
7 changes: 7 additions & 0 deletions encoding/json/encode.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"fmt"
"io"
"math/big"
goRuntime "runtime"
"strconv"
"strings"

Expand Down Expand Up @@ -76,6 +77,12 @@ func (e *Encoder) Encode(value cadence.Value) (err error) {
// capture panics that occur during struct preparation
defer func() {
if r := recover(); r != nil {
// don't recover Go errors
goErr, ok := r.(goRuntime.Error)
if ok {
panic(goErr)
}

panicErr, isError := r.(error)
if !isError {
panic(r)
Expand Down
29 changes: 29 additions & 0 deletions encoding/json/encoding_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1217,6 +1217,35 @@ func TestEncodePath(t *testing.T) {
}...)
}

func TestExportRecursiveType(t *testing.T) {

t.Parallel()

ty := &cadence.ResourceType{
TypeID: "S.test.Foo",
Identifier: "Foo",
Fields: []cadence.Field{
{
Identifier: "foo",
},
},
}

ty.Fields[0].Type = cadence.OptionalType{
Type: ty,
}

testEncode(
t,
cadence.Resource{
Fields: []cadence.Value{
cadence.Optional{},
},
}.WithType(ty),
`{"type":"Resource","value":{"id":"S.test.Foo","fields":[{"name":"foo","value":{"type": "Optional","value":null}}]}}`,
)
}

func convertValueFromScript(t *testing.T, script string) cadence.Value {
rt := runtime.NewInterpreterRuntime()

Expand Down
6 changes: 3 additions & 3 deletions languageserver/scripts/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion languageserver/scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"@types/node": "^12.6.9"
},
"dependencies": {
"typescript": "^3.5.3"
"typescript": "^3.9.7"
}
}
30 changes: 29 additions & 1 deletion languageserver/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ var containerCompletionItems = []*protocol.CompletionItem{
// Completion is called to compute completion items at a given cursor position.
//
func (s *Server) Completion(
conn protocol.Conn,
_ protocol.Conn,
params *protocol.CompletionParams,
) (
items []*protocol.CompletionItem,
Expand Down Expand Up @@ -1159,6 +1159,11 @@ func (s *Server) getDiagnostics(
diagnostics = append(diagnostics, extraDiagnostics...)
}

for _, hint := range checker.Hints() {
diagnostic := convertHint(hint)
diagnostics = append(diagnostics, diagnostic)
}

return
}

Expand Down Expand Up @@ -1303,3 +1308,26 @@ func convertError(err convertibleError) protocol.Diagnostic {
},
}
}

// convertHint converts a checker error to a diagnostic.
func convertHint(hint sema.Hint) protocol.Diagnostic {
startPosition := hint.StartPosition()
endPosition := hint.EndPosition()

return protocol.Diagnostic{
Message: hint.Hint(),
// protocol.SeverityHint doesn't look prominent enough in VS Code,
// only the first character of the range is highlighted.
Severity: protocol.SeverityInformation,
Range: protocol.Range{
Start: protocol.Position{
Line: float64(startPosition.Line - 1),
Character: float64(startPosition.Column),
},
End: protocol.Position{
Line: float64(endPosition.Line - 1),
Character: float64(endPosition.Column + 1),
},
},
}
}
Loading

0 comments on commit 05c67be

Please sign in to comment.